App crash then startup for apple

2

I'm new of stack overflow. I have a big problem to send an app to apple. when i test my app to my iPhone 5 or simulator everything is ok but apple reject for 2 times my app, they told me that my app crash then the splash screen and give me the crash log. but I've read some tutorial online and i don't understand how read and find the problem in the crash log. Could you help me about that.

this is the apple crash log about my app:

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

My app in the delegate don't do anything I don't touch it, when start my app I get just the contacts from the addressbook if you need some code tell me.

More code:

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];

Before of this code I check just if I have the access to address book.

What Apple told me:

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.

Thanks

Mirko

ios6
crash
crash-reports
abaddressbook
asked on Stack Overflow Aug 17, 2013 by Mirko Catalano • edited Aug 19, 2013 by Mirko Catalano

1 Answer

2

Read up from the bottom of the thread 0 log. You will see the flow of the method calls through your app. Anything with an underscore _ is an Apple private API call. Public calls you see are loading your window (in the AppDelegate) and then constructing your UIViewController (which is a scroll view of some sort?).

You code is crashing on CFArrayGetValueAtIndex. Most probably you are indexing past the end of an array when your view controller is created.

Can you post code of the root view controller that is created when your app starts?

answered on Stack Overflow Aug 17, 2013 by stevekohls

User contributions licensed under CC BY-SA 3.0