通用应用程序在每个备用时间在iPad模拟器上崩溃

时间:2011-02-09 04:32:41

标签: iphone crash ios-simulator universal

我的应用程序在备用版本的iPad模拟器上崩溃,崩溃然后运行然后崩溃等等。

objc[1116]: Class Protocol is implemented in both /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libobjc.A.dylib and /Users/NGA24iMAC3/Library/Application Support/iPhone Simulator/4.2/Applications/C0FFA7D7-7684-4854-B641-62BD11CFD226/Innovations.app/Innovations. One of the two will be used. Which one is undefined.
2011-02-09 11:53:01.446 Innovations[1116:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "PadLoginScreen" nib but the view outlet was not set.'

*** Call stack at first throw:
(
    0   CoreFoundation                      0x01286be9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x013db5c2 objc_exception_throw + 47
    2   CoreFoundation                      0x0123f628 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x0123f59a +[NSException raise:format:] + 58
    4   UIKit                               0x004a2b75 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
    5   UIKit                               0x004a0709 -[UIViewController loadView] + 120
    6   UIKit                               0x004a05e3 -[UIViewController view] + 56
    7   UIKit                               0x0049ea57 -[UIViewController contentScrollView] + 42
    8   UIKit                               0x004af201 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
    9   UIKit                               0x004ad831 -[UINavigationController _layoutViewController:] + 43
    10  UIKit                               0x004aeb4c -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
    11  UIKit                               0x004a9606 -[UINavigationController _startDeferredTransitionIfNeeded] + 266
    12  UIKit                               0x004b083e -[UINavigationController pushViewController:transition:forceImmediate:] + 932
    13  UIKit                               0x004a94a0 -[UINavigationController pushViewController:animated:] + 62
    14  Innovations                         0x00006172 -[SplashScreenController switchView] + 303
    15  Foundation                          0x001887a5 __NSFireTimer + 125
    16  CoreFoundation                      0x01267fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    17  CoreFoundation                      0x01269594 __CFRunLoopDoTimer + 1220
    18  CoreFoundation                      0x011c5cc9 __CFRunLoopRun + 1817
    19  CoreFoundation                      0x011c5240 CFRunLoopRunSpecific + 208
    20  CoreFoundation                      0x011c5161 CFRunLoopRunInMode + 97
    21  GraphicsServices                    0x01b52268 GSEventRunModal + 217
    22  GraphicsServices                    0x01b5232d GSEventRun + 115
    23  UIKit                               0x0040142e UIApplicationMain + 1160
    24  Innovations                         0x00002e70 main + 102
    25  Innovations                         0x00002e01 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.

但所有插座都在IB中正确设置。请帮助我。提前做好。

4 个答案:

答案 0 :(得分:3)

@Ishu我认为您在IB中的联系出了问题。我知道您检查过您的IB,但是您可以再次制作.xib文件。

答案 1 :(得分:0)

我建议清理你的项目。 Command + Shift + K

接下来,打开您的XIB文件并验证“文件所有者”的视图插座是否已连接到您的视图。不连接它并保存。

重建您的项目。

答案 2 :(得分:0)

我的Universal应用程序也面临同样的问题。

我做了类似这样的事情来解决我的问题 -

- (id)initWithNibName:(NSString *)n bundle:(NSBundle *)b
{
    return [self init];
}


- (id)init
{



    BOOL iPad = NO;
#ifdef UI_USER_INTERFACE_IDIOM
    iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#endif


    if (iPad) 
    {
        // iPad specific code here
        NSLog(@"Device is iPad");
        [super initWithNibName:@"ContactUsViewController~ipad" bundle:nil];

    } else 
    {
        // iPhone/iPod specific code here
        NSLog(@"Device is iPhone");
        [super initWithNibName:@"ContactUsViewController" bundle:nil];

    }

    return self;
}

当您添加/推送viewController时,只需调用其init方法然后推送viewcontroller。

答案 3 :(得分:0)

  1. 在Interface Builder中打开我们的iPad xib
  2. 点击文件的拥有者
  3. 在检查器中,转到第四个选项卡(标识)
  4. 以类标识的形式写入充当该xib的视图控制器的类的名称。
  5. 准备好了!