由于UIPopoverController,通用iOS应用程序在iPhone/iTouch 3.1.3上崩溃

Nim*_*rod 2 iphone xcode cocoa-touch ipad ios

我刚刚更新了我的应用程序,因此它是一个通用应用程序.这样做我UIPopoverController在某个地方增加了支持.现在该应用程序似乎在3.1.3 iPhone/iTouch设备上崩溃:

OS Version:      iPhone OS 3.1.3 (7E18)
Report Version:  104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread:  0

Dyld Error Message:
  Symbol not found: _OBJC_CLASS_$_UIPopoverController
Run Code Online (Sandbox Code Playgroud)

我没有得到的是,如果硬件是iPad,我只会尝试调用UIPopoverController:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:btc];
    CGSize popoverSize = { 300.0, 500.0 };
    popover.delegate = self;
    popover.popoverContentSize = popoverSize;
    self.bmPopover = popover;
    [popover release];

    [self.bmPopover presentPopoverFromBarButtonItem:self.bmBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
    [self presentModalViewController:nav animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

我确实有一个iVar和一个UIPopoverController声明类型的属性但我不希望这会在运行时引起问题,如果我实际上没有尝试在类中调用方法.

我不应该做什么来确保UIPopoverController在不支持时系统不会尝试在运行时链接?

Krz*_*cki 5

对于通用应用程序,您不仅应检查这是否是ipad或此类是否存在,而且您应将UIKit链接为弱引用而非默认(强),为此:

  1. 获得目标信息
  2. 选择一般
  3. 在链接库中更改UIKit所需的UIKit弱

制作通用应用程序很有趣:]