2010-10-08 44 views
1

我正在为iphone/ipad构建通用程序,并且已将部署目标设置为3.0。它可以在iPad 3.2和iPhone 4.1上运行良好。但是,当我在iPod 3.1.3上构建并运行它时,运行时会自动选取iPad代码路径,并告诉我它无法找到UIPopOverController和UIMenuItem。在我的iPhone路径代码中,我不使用类似的东西。如何在iPod上运行通用应用程序(iPad和iPhone 4.1)3.1.3

它成功地建立并只试图运行时,它说的错误,并不能找到:

dyld: Symbol not found: _OBJC_CLASS_$_UIPopoverController 
    Referenced from: /var/mobile/Applications/My_APP 
    Expected in: /System/Library/Frameworks/UIKit.framework/UIKit 

Editted

如果我删除所有我的iPad类的,并设置App.info主要的笔尖捆绑为iPhone。然后,它运作良好。我认为问题在于它运行iPad代码。我不知道我的iPod或我的项目有什么问题

+1

可能重复http://stackoverflow.com/questions/2618889/universal-iphone-ipad-application-debug-compilation-error-for-iphone-testing) – 2010-10-08 17:08:30

+0

没错。感谢您分享链接 – vodkhang 2010-10-09 01:02:11

回答

2

您需要对3.1.3上不存在的类进行运行时测试。你不能有像[UIPopoverControler alloc]这样的代码,你必须弱化链接到框架。

见这个问题的答案:

How should I approach building a Universal iOS app that will include iOS 4 features, even though the iPad doesn't yet run iOS 4?

(现在的问题是你的不同,但根本的问题是同一个。)

或者这篇文章:

http://cocoawithlove.com/2010/07/tips-tricks-for-conditional-ios3-ios32.html

+0

+1分享链接。但我认为这不是我的问题。我已经尝试过检查iOS4属性,我认为我的问题是Xcode auto会将我的iPod检测为iPad设备,并为其运行iPad代码 – vodkhang 2010-10-08 14:37:48

+0

您是否可以更新您的问题以显示您是如何决定是否运行ipad代码或iPhone的代码? Xcode不会照顾你,你必须手动检查并加载正确的笔尖等,例如使用[[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) – JosephH 2010-10-08 15:23:52

+0

您是否尝试过使用通用应用程序?它通过指定第一个窗口在Info.plist中确定。我只为iPhone指定了MainWidow_iPhone.xib,为iPad指定了MainWindow_iPad.xib。我在iPhone 4.0和iPad 3.2上测试过,效果很好,只有iPod 3.1.3的问题。 – vodkhang 2010-10-08 16:07:29

1

如果您只是想解决编译时问题,因为该设备将会我从不有问题的代码,那么你可以直接叫酥料饼等类这种方式:

Class infopopclass = NSClassFromString(@"UIPopoverController"); 
if(infopopclass) { 
    id infopop = [[infopopclass alloc] initWithContentViewController:myPopViewController]; 
    [infopop presentPopoverFromRect:CGRectMake(20, 70, 10, 10) inView:self.view permittedArrowDirections:4 animated:YES]; 
} 
[为iPhone测试通用的iPhone/iPad应用调试编译错误(指
相关问题