ios - Apple Watch pre-build action to change storyboard customModule references -


i have project 3 different versions of same app (different branding , such), working fine. i've since added 3 new apple watch targets (1 each app "version"), 2 of them reference files in "master" apple watch target.

everything works fine long remember change module reference each storyboard view, maps correct interface controller in corresponding watchkit extension target.

however, remembering switch every time need run/build app version/target pain , not long term solution.

i've created following command want run @ correct time, such changes storyboard references before compiled.

perl -pi.bak -e 's/custommodule=\"(.*?)\">/custommodule=\"watchmytarget_extension\">/g' ${srcroot}/watch/base.lproj/interface.storyboard 

i concluded want reset change after app compiled, since don't want have file change git complain about. why aforementioned script creates .bak file. after compilation done , packed/run on device or whatever, want run

mv ${srcroot}/watch/base.lproj/interface.storyboard.bak ${srcroot}/watch/base.lproj/interface.storyboard 

i've tried placing scripts in target's (watchtarget, not apptarget) build scheme, build->pre/post actions didn't seem have effect. , tried putting in run->pre/post actions worked degree, seemed post action kicked in before app pushed simulator , crashing application ("could not run see device logs" or that).

so on earth need put these scripts have them run @ correct time in build process?

you should use add new run script phase in target's build phases, place before compile sources

steps: (from apple)

  1. in project editor, select target want add run script build phase.
  2. click build phases @ top of project editor.
  3. choose editor > add build phase > add run script build phase.
  4. disclose run script section in project editor.
  5. configure script in run script template.

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -