Universal iPhone/iPad application debug compilation error for iPhone testing

跟風遠走 提交于 2019-11-26 15:48:43

That error is being triggered because you didn't weak-link the UIKit framework. The UIKit framework in iPhone OS 3.2 added the UISplitViewController, and if you link it in as normal your application will assume those symbols exist on 3.0, where they don't.

To weak-link a framework, find your application target in Xcode, inspect it, and go to the General tab. At the bottom of that tab should be a list of frameworks, with a column for Type. Change the Type for UIKit from Required to Weak and rebuild your application. That should take care of the runtime errors.

Your conditional logic is sound, but I tend to share an application delegate and do the interface-specific layout further down the line.

(Update: 12/21/2011) As of iOS 4.2, you should no longer need to weak link frameworks to prevent errors like this. As Marco Arment describes, if you build with iOS 4.2 or later and target down to iPhone OS 3.1+, individual classes are now weak linked and should have their +class method return nil if the class does not exist on the currently running version of the OS.

I was having a very similar error and it was driving me nuts! :-) Searching for hours and couldn't figure it out...

Like you said, everything was fine when running in the iPad Simulator but when trying to test the App on the iPhone with iPhone OS 3.1.2 it would not even start but crash with the following error message:

mi_cmd_stack_list_frames not enough frames in stack

By checking nearly every line of code I realised that the allocating of 3.2 classes like UIPopoverController or UISplitViewController (already inside forked iPad-specific code) was causing the problem.

So instead of i.e.:

infoPopover = [[UIPopoverController alloc] initWithContentViewController: infoNavController];

i would write

infoPopover = [[NSClassFromString(@"UIPopoverController") alloc] initWithContentViewController: infoNavController];

and that solved my problem! (Debugging can be so hard if the error message gives you no clue about where the bug could possibly be found...)

Xcode 8.3, iPad 2 (non retina), Swift 3 code

What helped for me was:

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