&“未找到符号"iPhone/iPad通用应用中的UIPopoverController错误 [英] "Symbol not found" error for UIPopoverController in an iPhone/iPad Universal App

查看:51
本文介绍了&“未找到符号"iPhone/iPad通用应用中的UIPopoverController错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的通用二进制iPhone/iPad应用程序中,用户可以在以模态显示的视图控制器中调整首选项.在iPhone上,设置面板上显示有presentModalViewController:animated :,在iPad上,我使用了UIPopoverController.

In a universal binary iPhone/iPad app of mine, users are able to adjust preferences in a view controller that's presented modally. On the iPhone, the settings panel is presented with presentModalViewController:animated:, and on the iPad, I use a UIPopoverController.

我有一点时间将UIPopoverController代码与iPhone代码完全隔离.每次我为iPhone编译时,都会出现以下错误:

I'm having a heck of a time completely isolating the UIPopoverController code away from the iPhone code. Everytime I compile for the iPhone, I get the following error:

dyld: Symbol not found: _OBJC_CLASS_$_UIPopoverController
  Referenced from: /var/mobile/Applications/CBB37F87-AA6D-47E2-823A-E259E3268A32/MyApp debug.app/MyApp
  Expected in: /System/Library/Frameworks/UIKit.framework/UIKit

这当然是因为iPhone上的UIKit没有UIPopoverController类.是否有人对如何有效地将iPad API包括与iPhone代码隔离开来提出建议,以便我可以实际运行我的代码?

This is of course because UIKit on the iPhone doesn't have a UIPopoverController class. Does anybody have advice for how to effectively isolate the iPad API includes from the iPhone code, so I can actually run my code?

推荐答案

啊,没关系.看看苹果的示例应用程序"TopPaid"

Ahhhh nevermind. Check out Apple's example app "TopPaid"

有点怪,但是可以用.希望有一个更优雅的解决方案...

It's kinda hacky, but it works. Wish there was a more elegant solution...

Class cls = NSClassFromString(@"UIPopoverController");
if (cls != nil)
{
    UIPopoverController *aPopoverController =
        [[cls alloc] initWithContentViewController:self.masterViewController];
    self.popoverController = aPopoverController;

    [aPopoverController release];

    [popoverController presentPopoverFromBarButtonItem:barButtonItem
                              permittedArrowDirections:UIPopoverArrowDirectionUp
                                              animated:YES];
}

这篇关于&“未找到符号"iPhone/iPad通用应用中的UIPopoverController错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆