ios6 - 苹果应用程序崩溃然后启动

标签 ios6 crash crash-reports abaddressbook

我是堆栈溢出的新手。我在向苹果发送应用程序时遇到了一个大问题。当我在 iPhone 5 或模拟器上测试我的应用程序时,一切正常,但苹果拒绝了我的应用程序 2 次,他们告诉我,我的应用程序崩溃了,然后出现了闪屏,并给了我崩溃日志。但我在网上阅读了一些教程,但我不明白如何阅读并在崩溃日志中找到问题。 你能帮我解决这个问题吗?

这是关于我的应用程序的苹果崩溃日志:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreFoundation                  0x316a1574 CFArrayGetValueAtIndex + 96
1   CWay                            0x000a065e 0x9c000 + 18014
2   CWay                            0x0009f3d6 0x9c000 + 13270
3   UIKit                           0x33589590 -[UIViewController loadViewIfRequired] + 360
4   UIKit                           0x335de146 -[UIViewController contentScrollView] + 22
5   UIKit                           0x335de08c -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
6   UIKit                           0x335ddf70 -[UINavigationController _layoutViewController:] + 28
7   UIKit                           0x335dde94 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 268
8   UIKit                           0x335dd5d4 -[UINavigationController _startTransition:fromViewController:toViewController:] + 60
9   UIKit                           0x335dd4bc -[UINavigationController _startDeferredTransitionIfNeeded:] + 320
10  UIKit                           0x335ae4e4 -[UILayoutContainerView layoutSubviews] + 176
11  UIKit                           0x3356d7fe -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 254
12  QuartzCore                      0x33317d86 -[CALayer layoutSublayers] + 210
13  QuartzCore                      0x33317924 CA::Layer::layout_if_needed(CA::Transaction*) + 456
14  QuartzCore                      0x333467ca -[CALayer layoutIfNeeded] + 138
15  UIKit                           0x336170e4 -[UIViewController window:setupWithInterfaceOrientation:] + 204
16  UIKit                           0x336162d0 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 3616
17  UIKit                           0x336154a2 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 42
18  UIKit                           0x3361542c -[UIWindow _setRotatableViewOrientation:duration:force:] + 64
19  UIKit                           0x3374b304 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 100
20  UIKit                           0x335d368e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 214
21  UIKit                           0x335d33d0 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 688
22  UIKit                           0x335d2d36 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 154
23  UIKit                           0x335c9ea6 -[UIWindow addRootViewControllerViewIfPossible] + 366
24  UIKit                           0x335c5ae8 -[UIWindow _setHidden:forced:] + 360
25  UIKit                           0x336071e4 -[UIWindow makeKeyAndVisible] + 56
26  UIKit                           0x335ca83a -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1662
27  UIKit                           0x335c2846 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
28  UIKit                           0x3356ac34 -[UIApplication handleEvent:withNewEvent:] + 1000
29  UIKit                           0x3356a6c8 -[UIApplication sendEvent:] + 68
30  UIKit                           0x3356a116 _UIApplicationHandleEvent + 6150
31  GraphicsServices                0x3525e5a0 _PurpleEventCallback + 588
32  GraphicsServices                0x3525e1ce PurpleEventCallback + 30
33  CoreFoundation                  0x31737170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
34  CoreFoundation                  0x31737112 __CFRunLoopDoSource1 + 134
35  CoreFoundation                  0x31735f94 __CFRunLoopRun + 1380
36  CoreFoundation                  0x316a8eb8 CFRunLoopRunSpecific + 352
37  CoreFoundation                  0x316a8d44 CFRunLoopRunInMode + 100
38  UIKit                           0x335c1480 -[UIApplication _run] + 664
39  UIKit                           0x335be2fc UIApplicationMain + 1116
40  CWay                            0x0009dfb2 0x9c000 + 8114
41  libdyld.dylib                   0x39a3db1c start + 0

Thread 1 name:  Dispatch queue: com.apple.backboardservices.processassertion
Thread 1:
0   libsystem_kernel.dylib          0x39af4648 kevent64 + 24
1   libdispatch.dylib               0x39a24586 _dispatch_update_kq + 154
2   libdispatch.dylib               0x39a244e4 _dispatch_mgr_wakeup$VARIANT$mp + 40
3   libdispatch.dylib               0x39a21ca0 _dispatch_wakeup$VARIANT$mp + 20
4   libdispatch.dylib               0x39a21c3c _dispatch_queue_push_list_slow2 + 16
5   libdispatch.dylib               0x39a21e8e _dispatch_queue_drain$VARIANT$mp + 78
6   libdispatch.dylib               0x39a21dbc _dispatch_queue_invoke$VARIANT$mp + 36
7   libdispatch.dylib               0x39a2291a _dispatch_root_queue_drain + 182
8   libdispatch.dylib               0x39a22abc _dispatch_worker_thread2 + 80
9   libsystem_c.dylib               0x39a52a0e _pthread_wqthread + 358
10  libsystem_c.dylib               0x39a528a0 start_wqthread + 4

Thread 2 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0   libsystem_kernel.dylib          0x39af4648 kevent64 + 24
1   libdispatch.dylib               0x39a24974 _dispatch_mgr_invoke + 792
2   libdispatch.dylib               0x39a24654 _dispatch_mgr_thread$VARIANT$mp + 32

Thread 3:
0   libsystem_kernel.dylib          0x39b04d98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x39a52cf6 _pthread_workq_return + 14
2   libsystem_c.dylib               0x39a52a12 _pthread_wqthread + 362
3   libsystem_c.dylib               0x39a528a0 start_wqthread + 4

Thread 4 name:  WebThread
Thread 4:
0   libsystem_kernel.dylib          0x39af3eb4 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x39af4048 mach_msg + 36
2   CoreFoundation                  0x31737040 __CFRunLoopServiceMachPort + 124
3   CoreFoundation                  0x31735d9e __CFRunLoopRun + 878
4   CoreFoundation                  0x316a8eb8 CFRunLoopRunSpecific + 352
5   CoreFoundation                  0x316a8d44 CFRunLoopRunInMode + 100
6   WebCore                         0x37698500 RunWebThread(void*) + 440
7   libsystem_c.dylib               0x39a5d30e _pthread_start + 306
8   libsystem_c.dylib               0x39a5d1d4 thread_start + 4

Thread 5 name:  com.apple.coremedia.player.async
Thread 5:
0   libsystem_kernel.dylib          0x39b0408c __psynch_cvwait + 24
1   libsystem_c.dylib               0x39a55d2a _pthread_cond_wait + 642
2   libsystem_c.dylib               0x39a5ff14 pthread_cond_wait + 36
3   CoreMedia                       0x31c8e8ac FigSemaphoreWaitRelative + 256
4   MediaToolbox                    0x32780e56 fpa_AsyncMovieControlThread + 22
5   CoreMedia                       0x31cac890 figThreadMain + 192
6   libsystem_c.dylib               0x39a5d30e _pthread_start + 306
7   libsystem_c.dylib               0x39a5d1d4 thread_start + 4

Thread 6:
0   libsystem_kernel.dylib          0x39b04d98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x39a52cf6 _pthread_workq_return + 14
2   libsystem_c.dylib               0x39a52a12 _pthread_wqthread + 362
3   libsystem_c.dylib               0x39a528a0 start_wqthread + 4

Thread 0 crashed with ARM Thread State (32-bit):
    r0: 0x00000000    r1: 0x00000086      r2: 0x00000002      r3: 0x00000013
    r4: 0x20858240    r5: 0x2fd61e84      r6: 0x00000004      r7: 0x2fd61f2c
    r8: 0x00000000    r9: 0x00000000     r10: 0x1fd5f1c0     r11: 0x1fd6f3c0
    ip: 0x316a1515    sp: 0x2fd61dc0      lr: 0x000a0663      pc: 0x316a1574
  cpsr: 0x60000030

我的委托(delegate)中的应用程序不做任何事情,我不碰它,当启动我的应用程序时,我只从地址簿中获取联系人,如果您需要一些代码,请告诉我。

更多代码:

if (accessGranted) {




        CFArrayRef sources = (__bridge CFArrayRef)(CFBridgingRelease(ABAddressBookCopyArrayOfAllSources(_addressBook)));

        ABRecordRef source = (__bridge ABRecordRef)(CFBridgingRelease(CFArrayGetValueAtIndex(sources, 0)));

        CFIndex longezza =  ABAddressBookGetPersonCount(_addressBook);
        NSLog(@"%ld", longezza);



        CFArrayRef people = (__bridge CFArrayRef)(CFBridgingRelease(ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(_addressBook, source, kABPersonSortByFirstName)));

        // len = count all contacts
        int len = CFArrayGetCount(people);

        NSLog(@"%d", len);

        for (CFIndex i = 0 ; i <= (len - 1) ; i++) {

            [contactArray removeAllObjects];

            //Get contact's record from _addressBook

            ABRecordRef recordContact = CFArrayGetValueAtIndex(people, i);

            //Get the first name

            NSString *firstName = CFBridgingRelease((ABRecordCopyValue(recordContact, kABPersonFirstNameProperty)));


            //Get the last name
            NSString *lastName = CFBridgingRelease((ABRecordCopyValue(recordContact, kABPersonLastNameProperty)));



            //Create the full name

            NSMutableString *fullName = [[NSMutableString alloc] initWithString:@""];

            if (firstName) [fullName appendFormat:@"%@ ",firstName];
            if (lastName) [fullName appendFormat:@"%@",lastName];


            if (![fullName isEqualToString:@""]) {
                //Add full name into the ContactsArray

                [contactArray addObject:fullName];


                /////Start The Algoritmo for order the phone's number in the array/////

                //Get array with all Phone number's contact

                ABMultiValueRef NumberPhones = ABRecordCopyValue(recordContact, kABPersonPhoneProperty);


                //If the NumberPhones contain something start the cicle for get the number

                if (ABMultiValueGetCount(NumberPhones))
                {

                    //Start the cicle for get the number and the label

                    for (CFIndex x = 0; x < ABMultiValueGetCount(NumberPhones); x++)
                    {

                        //Create array with labels types and names

                        NSArray *labelsTypes = [[NSArray alloc] initWithObjects:@"_$!<Mobile>!$_", @"_$!<Home>!$_", @"iPhone",@"", @"_$!<Work>!$_", @"_$!<Main>!$_", @"_$!<Other>!$_", nil];

                        NSArray *labelsNames = [[NSArray alloc] initWithObjects:@"Mobile", @"Home", @"iPhone",@"", @"Work", @"Main", @"Other", nil];


                        //Get the label from NumberPhones

                        NSString *label = (__bridge NSString *)(ABMultiValueCopyLabelAtIndex(NumberPhones, x));


                        //start the cicle for find the label type

                        for (int y = 0; y < 7; y++)
                        {

                            //if the label type is the same get the info and punt in array

                            if ([label isEqual:[labelsTypes objectAtIndex:y]])
                            {

                                //Get the Number

                                NSString *number = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(NumberPhones, x));

                                //Create Dictionary with label = value, object = value

                                NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:[labelsNames objectAtIndex:y], @"label", number, @"object", nil];

                                //Add dictionary into the ContactArray

                                [contactArray addObject:dic];

                            } //end if
                        } //end for
                    } //end for
                } //end if


                //Release NnumberPhones

                CFRelease(NumberPhones);


                /////Finish the algoritmo for get the number/////

                /////Start the algoritmo for get the Email/////


                //Get array with all email's contact

                ABMultiValueRef emails = ABRecordCopyValue(recordContact, kABPersonEmailProperty);


                //If the NumberPhones contain something start the cicle for get the email

                if (ABMultiValueGetCount(emails))
                {

                    //Start the cicle for get the email

                    for (CFIndex x = 0; x < ABMultiValueGetCount(emails); x++)
                    {

                        NSString *email = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(emails, x));

                        //Create Dictionary with label = value, object = value

                        NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:@"Email", @"label", email, @"object", nil];

                        //Add dictionary into the ContactArray


                        [contactArray addObject:dic];
                        CFRelease((__bridge CFTypeRef)(email));

                    } //end for
                } //end if


                //Release emails

                CFRelease(emails);

                /////Finish the algoritmo for get the Email/////

                /////Start the algoritmo for get the social network//////


                //Get array with all social's contact

                ABMultiValueRef socials = ABRecordCopyValue(recordContact, kABPersonSocialProfileProperty);


                //If the NumberPhones contain something start the cicle for get the social network

                if (ABMultiValueGetCount(socials))
                {

                    //Start the cicle for get the social network

                    for (CFIndex  x = 0; x < ABMultiValueGetCount(socials); x++)
                    {

                        //Get the dictionare with each social network info

                        NSDictionary *social = (__bridge NSDictionary *)(ABMultiValueCopyValueAtIndex(socials, x));


                        //If the social network is facebook get the info and put into the array

                        /*if ([social[@"service"] isEqual:@"facebook"])
                        {
                            NSString *facebook = social[@"username"];

                            //Create Dictionary with label = value, object = value

                            NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:@"Facebook", @"label", facebook, @"object", nil];


                            //Add dictionary into the ContactArray

                            [contactArray addObject:dic];

                        } //Else if the social network is Twitter get the info and put into the array
                        else */ if ([social[@"service"] isEqual:@"twitter"])
                        {
                            NSString *twitter = social[@"username"];

                            //Create Dictionary with label = value, object = value

                            NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:@"Twitter", @"label", twitter, @"object", nil];


                            //Add dictionary into the ContactArray

                            [contactArray addObject:dic];




                        }// end if
                        CFRelease((__bridge CFTypeRef)(social));
                    } //end for
                } //end if


                //release Social

                CFRelease(socials);


                /////Finish the algoritmo for get the social network//////


            } //end if controll full name = @""


    if (contactArray.count) {
        [contactsArray addObject:[contactArray copy]];
    }

        } //end for


    } //end if

    return [contactsArray copy];

在此代码之前,我检查我是否有权访问地址簿。

苹果告诉我的:

2.1

We found that your app crashed on iPad running iOS 6.1.3 and iPhone 5 running iOS 6.1.4, which is not in compliance with the App Store Review Guidelines.

Your app crashed when we launched it.

This occurred when your app was used: 

- On Wi-Fi 
- On cellular network

We have attached detailed crash logs to help troubleshoot this issue. For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.

If you have difficulty reproducing this issue, please try testing the workflow as described in Testing Workflow with Xcode's Archive feature.

For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to prepare any symbolicated crash logs, screenshots, or steps to reproduce the issues for when the DTS engineer follows up.

谢谢

米尔科

最佳答案

从线程0日志的底部向上读取。您将看到通过您的应用程序调用方法的流程。任何带有下划线 _ 的内容都是 Apple 私有(private) API 调用。您看到的公共(public)调用正在加载您的窗口(在 AppDelegate 中),然后构造您的 UIViewController (这是某种 ScrollView ?)。

您的代码在 CFArrayGetValueAtIndex 上崩溃。当创建 View Controller 时,您很可能正在索引超出数组末尾的索引。

您可以发布应用程序启动时创建的 Root View Controller 的代码吗?

关于ios6 - 苹果应用程序崩溃然后启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18289167/

相关文章:

ios - 单击不选择 uitableview ios 7 中的行

按下主页按钮时 iOS 应用程序崩溃(当应用程序暂停时)

ios - 如何在我的应用程序中添加 PLCrashReporter?

ios - 更改为 iOS 6 后应用程序崩溃 - ucol getVersion

android - Xamarin.Forms 崩溃报告和分析建议/建议

iphone - 从应用程序本身访问相机

iphone - iOS - 在 iphone 5 分辨率上支持 xib

css - 溢出 :hidden on body is broken in ios6

swift - 使用 Crashlytics 错误日志修复我的崩溃

android - 如何解决崩溃 : Dns. java okhttp3.Dns$1.lookup?