App crash randomly on some iOS9 devices after closing camera controller

294 views Asked by At

I got the following crash report, sent by a user, but I don't know the possible reason. The app crash randomly when calling

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 

delegate, after the user tap "use photo" on camera controller. In this delegate I do some Image processing (compression and resizing) and I upload the resulting image to a webserver:

Edit: the crash happens randomly after calling:

NSURLConnection sendAsynchronousRequest

only on iPhone6 devices

This is the crash report:

Incident Identifier: 8B05FEB7-F7A7-4399-A735-7BE1F7D6B28C
CrashReporter Key:   c61d3329a1a016eb2f279bdb36b2c6441c3359b4
Hardware Model:      iPhone7,2
Process:             xxxapp [469]
Path:                /private/var/mobile/Containers/Bundle/Application/84A5A17B-D548-4182-B11F-D5F748B88B1C/MMBRevisioniTestTarga.app/MMBRevisioniTestTarga
Identifier:        xxx.app
Version:             108 (1.0)
Code Type:           ARM-64 (Native)
Parent Process:      launchd [1]

Date/Time:           2016-05-02 13:31:22.22 +0200
Launch Time:         2016-05-02 09:48:02.02 +0200
OS Version:          iOS 9.2.1 (13D15)
Report Version:      105

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000012e1af30
Triggered by Thread:  0

Filtered syslog:
None found

Global Trace Buffer (reverse chronological seconds):
1.099550     AppleJPEG                  0x000000018210ab54 [0x12d920e00] Releasing session
1.530599     AppleJPEG                  0x000000018210ab54 [0x12e215800] Releasing session
1.535648     AppleJPEG                  0x000000018210ab54 [0x12d94e200] Releasing session
1.541815     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12eb81731) failed
1.546529     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d73d581) failed
1.546672     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d57af01) failed
1.547266     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d5f6481) failed
1.551646     AppleJPEG                  0x000000018210cff4 [0x12d94e200] Decoding completed without errors
1.551646     AppleJPEG                  0x000000018210b18c [0x12d94e200] Options: 320x86 [FFFFFFFF,FFFFFFFF] 0001D060
1.551646     AppleJPEG                  0x000000018210b044 [0x2d94e200] Decoding:  1 0x000000C0 0x01400056 0x0028304A 0x11111100 0
1.552181     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d7399e1) failed
1.553200     AppleJPEG                  0x000000018210a338 [0x12d94e200] Created session
1.555675     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d7a9521) failed
1.557307     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e8d3e31) failed
1.557582     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d7b4c51) failed
1.559249     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e8f1191) failed
1.560348     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e8848f1) failed
1.597807     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e8ce201) failed
1.599417     AppleJPEG                  0x000000018210a338 [0x2e215800] Created session
1.614643     libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d7845c1) failed
4.189911     AppleJPEG                  0x000000018210a338 [0x12d920e00] Created session
13.027686    AppleJPEG                  0x000000018210ab54 [0x12d8aee00] Releasing session
13.038310    AppleJPEG                  0x000000018210ab54 [0x12d920800] Releasing session
13.038310    AppleJPEG                  0x000000018210a338 [0x12d920800] Created session
13.038310    AppleJPEG                  0x000000018210a338 [0x12d8aee00] Created session
13.602625    CFNetwork                  0x000000018107d84c TCP Conn 0x12d5fb2d0 SSL Handshake DONE
13.751047    CFNetwork                  0x000000018107d75c TCP Conn 0x12d5fb2d0 starting SSL negotiation
13.752205    CFNetwork                  0x000000018111f104 TCP Conn 0x12d5fb2d0 complete. fd: 12, err: 0
13.754004    CFNetwork                  0x0000000181120630 TCP Conn 0x12d5fb2d0 event 1. err: 0
13.844813    CFNetwork                  0x0000000181120708 TCP Conn 0x12d5fb2d0 started
13.890467    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e856b51) failed
13.890467    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d6a3791) failed
13.890741    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e8bdd61) failed
15.344835    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d794961) failed
17.168638    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d6eb621) failed
17.168638    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x2e827071) failed
17.168919    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e8cef41) failed
19.538093    AppleJPEG                  0x000000018210ab54 [0x12e209e00] Releasing session
19.967655    AppleJPEG                  0x000000018210ab54 [0x2e214e00] Releasing session
19.968163    AppleJPEG                  0x000000018210ab54 [0x12e21fa00] Releasing session
19.980956    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12d76bb21) failed
19.982429    libsystem_trace.dylib      0x00000001807289cc dyld_image_header_containing_address(0x12e8c13c1) failed
2

There are 2 answers

4
J. Lopes On

I was getting a similar error in an iPad app. So make sure my camera was running on mainThread solved my issue:

[[NSOperationQueue mainQueue] addOperationWithBlock:^{
    [self openCamera]; // Call your camera method here
}];

I hope this can help you.

1
Hasya On

Add below things in plist.

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>