2

我的应用程序在备用版本中在 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

4 回答 4

3

@Ishu 我认为您在 IB 中的连接有问题。我知道您检查了您的 IB,但您可以再次制作您的 .xib 文件。

于 2011-02-09T04:55:03.737 回答
0

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

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

重建你的项目。

于 2011-02-09T05:02:02.383 回答
0

我在通用应用程序中也遇到了同样的问题。

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

- (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;
}

当您添加/推送视图控制器时,只需调用其 init 方法,然后推送视图控制器。

于 2011-02-09T06:40:35.570 回答
0
  1. 在 Interface Builder 中打开我们的 iPad xib
  2. 单击文件的所有者
  3. 在检查器中,转到第四个选项卡(身份)
  4. 将充当该 xib 的视图控制器的类的名称写为类标识。
  5. 准备好出发!
于 2011-02-22T08:49:42.630 回答