当尝试在每个备用构建运行中打开特定模式视图时,应用程序在 iPhone 上崩溃

发布于 2024-09-24 08:01:27 字数 2008 浏览 3 评论 0原文

我有一个模态视图控制器,它根据 if 条件调用 viewDidLoad 中的另一个模态视图控制器。

我面临的奇怪问题是,第一次编译应用程序并打开第一个模式视图控制器时,它工作正常并且继续显示第二个视图控制器。现在,如果我停止应用程序执行并重建&运行应用程序,当我打开第一个模式视图时,应用程序崩溃(仅主页按钮工作时冻结)。

这是我得到的错误:

Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
_Unwind_Resume called from function -[NSArray makeObjectsPerformSelector:] in image CoreFoundation.
2010-09-23 20:19:56.526 MySuperDuperApp[6117:207] CoreAnimation: ignoring exception: [<TwitterLogin 0x7484dc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key actionButton.

TwitterLogin 是无法显示的第二个模式视图控制器的名称。

我尝试使用 NSLogs 来检查它到底在哪里崩溃。

    //... part of the method which is called in  
    // viewDidAppear of first modal view controller.
    - (void)login {
    NSLog(@"Begin TwitterBasicVC login");       
    loginPopup = [[TwitterLogin alloc] init];
    loginPopup.oAuth = oAuth;
    loginPopup.viewDelegate = self;
    loginPopup.interfaceDelegate = self;

    // Show Login screen.
    loginPopup.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    NSLog(@"presenting loginPopup modalView");
    [self presentModalViewController:loginPopup animated:YES];  
    [loginPopup release];
    NSLog(@"End TwitterBasicVC login");

    //... viewDidLoad of second modal view controller.
    - (void)viewDidLoad {
     NSLog(@"Begin TwitterLogin viewDidLoad");
         [super viewDidLoad];
     queue = [[NSOperationQueue alloc] init];
     ...

打印“presenting loginPopup modalView”消息,但不打印“Begin TwitterLogin viewDidLoad”消息。 我不知道为什么它在模态视图呈现和 viewDidLoad 之间崩溃。

更奇怪的是,每次我构建/运行应用程序时都会发生这种情况。 (我尝试删除应用程序并构建它,但它仍然发生)

编辑:我添加了登录方法的前几行,其中 twitterLogin 是分配初始化的。 我还尝试使用performSelector:withObject:afterDelay 调用该方法,值为0.0 和1.0,问题仍然存在。

编辑2:每次我尝试在iPhone/模拟器上安装应用程序时(从设备/模拟器中删除应用程序后),我都会进行一次干净的构建。该应用程序似乎使用此方法运行良好。我可以假设在应用程序商店上传应用程序是安全的吗?

关于如何进行调试的任何建议都会对我有很大帮助:)

谢谢

I have a modal view controller which calls another modal view controller in viewDidLoad based on an if condition.

The weird problem i'm facing is, the first time i compile the app and open the 1st modal view controller, it works fine and it goes on to show the 2nd view controller. Now, if i stop the app execution and rebuild & run the app, the app crashes (freezes with only the home button working) when i open the 1st modal view.

This is the error i get:

Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
_Unwind_Resume called from function -[NSArray makeObjectsPerformSelector:] in image CoreFoundation.
2010-09-23 20:19:56.526 MySuperDuperApp[6117:207] CoreAnimation: ignoring exception: [<TwitterLogin 0x7484dc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key actionButton.

TwitterLogin is the name of the 2nd modal view controller which fails to display.

I tried putting NSLogs to check where exactly it is crashing.

    //... part of the method which is called in  
    // viewDidAppear of first modal view controller.
    - (void)login {
    NSLog(@"Begin TwitterBasicVC login");       
    loginPopup = [[TwitterLogin alloc] init];
    loginPopup.oAuth = oAuth;
    loginPopup.viewDelegate = self;
    loginPopup.interfaceDelegate = self;

    // Show Login screen.
    loginPopup.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    NSLog(@"presenting loginPopup modalView");
    [self presentModalViewController:loginPopup animated:YES];  
    [loginPopup release];
    NSLog(@"End TwitterBasicVC login");

    //... viewDidLoad of second modal view controller.
    - (void)viewDidLoad {
     NSLog(@"Begin TwitterLogin viewDidLoad");
         [super viewDidLoad];
     queue = [[NSOperationQueue alloc] init];
     ...

The 'presenting loginPopup modalView' message is printed, however the 'Begin TwitterLogin viewDidLoad' message is not printed.
I don't know why it is crashing between the modal view presentation and viewDidLoad.

The weirder thing is that this happens every alternate time i build/run the app.
(I have tried deleting the app and building it but it still occurs)

EDIT: I have added the first few lines of the login method where twitterLogin is alloc-inited.
I have also tried calling the method with performSelector:withObject:afterDelay with values 0.0 and 1.0 and the problem still exists.

EDIT 2: I did a clean build each time i try to install the app on the iPhone/Simulator (after deleting the app from the device/simulator). The app seems to be working fine with this method. Can I assume that it is safe to upload the app on the app store?

Any suggestions on how I should proceed in debugging will greatly help me :)

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回忆凄美了谁 2024-10-01 08:01:27

我想不建议在同一循环迭代中模态显示两个控制器。

尝试在一些小的延迟后呈现第二个控制器(如果在 iOS4+ 上使用块,或者创建一个方法并通过 performSelector:withObject:afterDelay:0.1f 调用它)。

无论如何,我无法解释每次都会发生这种情况的奇怪之处。您是否在每次执行期间意外地翻转了某些设置(例如 isLoggedIn = !isLoggedIn; 并将其保留在 NSUserDefaults 中)。

I guess it's not recommended to modally display two controllers within the same loop iteration.

Try to present the second controller after some small delay (use blocks if on iOS4+ or create a method and call it via performSelector:withObject:afterDelay:0.1f).

Anyway, I can't explain the weirdness of this happening every second time. Do you by accident flip some setting during each execution (for example isLoggedIn = !isLoggedIn; and persisting it in NSUserDefaults).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文