Storyboard won't update in simulator

前提是你 提交于 2019-11-29 05:41:49
T0m_Twt
  1. Delete the App on the simulator.

  2. Clean

  3. List item

  4. Build & Run

Use NSLog(@"") in your controller to check code execution.

Brenden

I just spent at least 6 hours on this. I have a solution, but I also submitted a technical support ticket to apple to try to get more info on the cause and proper solution.

Simply remove the references to your storyboard files and add them back in the same file group.

This seems to include the storyboard files back into the app bundle generated during build(which can be seen in the

DerivedData/APPNAME/Build/Products/Debug-iphonesimultator/APPNAME.app 

From here I can see my changes reflected from the storyboards as expected.

PS - Are you using localization at all? I was.

I lost 2 hours to this.

Solution was braindead simple: delete app, turn OFF the iPhone 5S (iOS 7.1.1), and turn it bavk on.

When you turn on localization, xcode moves storyboard file in localization folder (ex. Base.lproj/name.storyboard). When you build and run project on simulator, xcode copy name.storyboard into "derivedData"/Base.lproj/name.storyboard, but previous, created before localization "derivedData"/name.storyboard still exists. In this case simulator uses the file which can be found easier, i.e simulator uses old file "derivedData"/name.storyboard to operate.

Solution: Just rename the storyboard file, in navigator and in targets/general.

This error happened to me for the first time when I had multiple copies of a project on my computer. For whatever reason, the fact that there were multiple copies were making it look as if the storyboard had not been updated between copies and in some cases the code was not updated. I thought I had forgotten to throw the right copy on my flash drive before going home, but it turned out it's an XCode error.

Delete any multiple copies using the same name, restart XCode and open your most recent copy. Extremely bizarre, but I will probably use BitBucket or GitHub from now on instead of throwing it on a flash drive.

Deleting

~/Library/Developer/Xcode/derivedData/

worked for me!

The storyboard on the simulator was what it should have been. The storyboard on the device would not update. I had to delete the application from the iPhone and then re-run it on the device in order to get the Storyboard to update on the device. Fortunately for me it was only test data, but I was using Auto-Layout on one view and went back to manual. I think that's what caused the issue for me.

I find that removing and adding storyboard file back doesn't work in my case, also it has side effects like it will automatically add a main nib entry into App's plist file (which subsequently makes the App fails to launch in iPhone simulator).

I don't want to try to delete the application from the simulator since I have many files under the Document directory of the App.

At last I find another way that works well: simply delete the "/Users/$username/Library/Application Support/iPhone Simulator/7.1/Applications/$app/$yourapp.app" file. The files under Documents directory are untouched.

(I have localized my storyboard as well.)

I found this same thing happened with Xcode 6.1.1 if I happened to have copied a project; the new project run in the simulator was actually still reflecting the old, original project.

In my case the problem was with how the default area was set up for derived data (essentially the location where the binary files go for a build). Mine was set to legacy and the simulator was using the wrong project, even after a clean. The solution was to go to Preferences->Locations, press Advanced, and change the location from Legacy to Unique.

I get this too when using localized storyboards - Run in Xcode just refuses to install the latest version of the compiled storyboard. I think it is something to do with the way Run copies changed resources across to the device - it does it differently than other forms of on device app installation.

The quickest way to get past this without deleting the app and losing any data is to:

  • Generate an Archive build in Xcode
  • Export this for Adhoc deployment
  • Double-click on the generated IPA to add it to iTunes
  • From the device page in iTunes force an update to that app

In order for iTunes to see that you have a new version your app build number will need to be incremented (if you don't do that already), before generating the archive.

I find this method means you don't have to delete an app off the device, you're just forcing it to install the entire install package rather than a diff which is what I think Run is doing.

I'm not sure what causes this, if it is a localized resources bug or what, but this is still a problem in Xcode 7 for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!