I have a problem with my iPhone application developed with MonoTouch.
I am developing an application that contacts a WCF Service, and when the WCF Service answer back, I update an UITableView with the returned data, when this is done it sends a new WCF async call, and when it answer back it updates the table again and so on.
The problem is that when it has done this in a variable amount of time, it crashes with an Mprotect failed error 12. This only happens when the application is running directly on the phone and not in the simulator.
I have tried to out comment where the update of the table happens, and making a Thread.Sleep(1000) before sending the next Async request to the WCF Service, but still the same error, but can run longer with out failing.
I contact the WCF Service through the "proxy" files, generated by SlSvcUtil.exe /noConfig http://mydomain/myservice.svc
My question is that can this error be avoid in a way or maybe with a workaround? Is it my fault, or is it a bug? It is actually because I shall use the application in my final school project, so it could be nice if I could fix it.
I post the console output, and a part from the crash report, but if you need more info please tell me, and I will post it. I am not a pro to use Mono or the MonoTouch environment it is my first time, so detailed responses would be nice.
Console output:
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: Mprotect failed at 0xa09a000 (length 1052672) with errno 12
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: Stacktrace:
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x000e0>
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: at MonoTouch.UIKit.UIApplication.Main (string[]) <0x00023>
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: at iPhoneStdView.Application.Main (string[]) <0x0001b>
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0x000c3>
Mon Dec 27 20:37:17 tests-iPhone UIKitApplication:dk.test.iphone[0x1c3c][625] <Notice>: Native stacktrace:
Mon Dec 27 20:37:18 tests-iPhone ReportCrash[635] <Notice>: Formulating crash report for process iPhoneNoNavigation[625]
Mon Dec 27 20:37:18 tests-iPhone com.apple.launchd[1] (UIKitApplication:dk.test.iphone[0x1c3c][625]) <Warning>: (UIKitApplication:dk.test.iphone[0x1c3c]) Job appears to have crashed: Abort trap
Mon Dec 27 20:37:18 tests-iPhone SpringBoard[27] <Warning>: Application 'iPhoneStdView' exited abnormally with signal 6: Abort trap
Crash report:
Thread 0 Crashed:
0 dyld 0x2fe08110 0x2fe00000 + 33040
1 libSystem.B.dylib 0x3020259e 0x301ff000 + 13726
2 libSystem.B.dylib 0x302531da 0x301ff000 + 344538
3 iPhoneNoNavigation 0x0051975c 0x1000 + 5343068
4 iPhoneNoNavigation 0x00538080 0x1000 + 5468288
5 libSystem.B.dylib 0x302765cc 0x301ff000 + 488908
6 libSystem.B.dylib 0x30201d64 0x301ff000 + 11620
7 CoreFoundation 0x3081fc38 0x307f8000 + 162872
8 CoreFoundation 0x3081f4c2 0x307f8000 + 160962
9 CoreFoundation 0x3081f270 0x307f8000 + 160368
10 CoreFoundation 0x3081f178 0x307f8000 + 160120
11 GraphicsServices 0x31e445ec 0x31e40000 + 17900
12 GraphicsServices 0x31e44698 0x31e40000 + 18072
13 UIKit 0x31e5111c 0x31e4d000 + 16668
14 UIKit 0x31e4f128 0x31e4d000 + 8488
15 iPhoneNoNavigation 0x0006e754 0x1000 + 448340
Thread 0 crashed with ARM Thread State:
r0: 0x35f4d17c r1: 0x302765a9 r2: 0x35989b04 r3: 0x0000000e
r4: 0x2fe29e78 r5: 0x07d17490 r6: 0x302765d3 r7: 0x2fffe24c
r8: 0x00000000 r9: 0x3598762c r10: 0x0000000d r11: 0x07d17470
ip: 0x3598762c sp: 0x2fffe240 lr: 0x3e08dc60 pc: 0x2fe08110
cpsr: 0x20000030
Error 12 is ENOMEM, you've exhausted all the memory available on the iphone.
Related
It is really very strange for me as my app is working fine at debug mode & when tried by tester with release build RARELY it gives crash. What I have understood from console log & crash log is that somewhere UI is trying to update from secondary thread but NOT always.
At crash point my console log says,
MyApp[715] <Warning>: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.May 21 10:51:25
MyApp[715] <Warning>: bool _WebTryThreadLock(bool), 0x1e1dd280: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...May 21 10:51:25
MyApp[715] <Notice>: 1 0x38b048f7 WebThreadLock
& device crash logs crash thread description & error type are as below
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xbbadbeef
Crashed Thread: 15
.
.
.
Thread 15 Crashed: 0
WebCore 0x38b03944_WebTryThreadLock(bool) + 164 1
WebCore 0x38b048f2 WebThreadLock + 62 2
UIKit 0x374424f6 -[UIWebTiledView layoutSubviews] + 38 3
UIKit 0x374424c6 -[UIWebDocumentView layoutSubviews] + 106 4
UIKit 0x373bb7fe -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 254 5
QuartzCore 0x30e92d5e -[CALayer layoutSublayers] + 210 6
QuartzCore 0x30e928fc CA::Layer::layout_if_needed(CA::Transaction*) + 456 7
QuartzCore 0x30e93830 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 12 8
QuartzCore 0x30e93216 CA::Context::commit_transaction(CA::Transaction*) + 234 9
QuartzCore 0x30e93024 CA::Transaction::commit() + 312 10
QuartzCore 0x30ed9df6 CA::Transaction::release_thread(void*) + 166 11 libsystem_c.dylib 0x31150128 _pthread_tsd_cleanup + 172 12
libsystem_c.dylib 0x3114fdfe _pthread_exit + 114 13
libsystem_c.dylib 0x31169160 pthread_exit + 24 14
Foundation 0x358bf226 +[NSThread exit] + 6 15
Foundation 0x35936696 __NSThread__main__ + 998 16
libsystem_c.dylib 0x3115d30e _pthread_start + 306 17
libsystem_c.dylib 0x3115d1d4 thread_start + 4
Thread 15 crashed with ARM Thread State (32-bit): r0: 0xbbadbeef r1: 0x00000000 r2: 0x030ba404 r3: 0x00000001 r4: 0x1e1dd280 r5: 0x3b4cacc0 r6: 0x00000000 r7: 0x030baa74 r8: 0x00000028 r9: 0x00006200 r10: 0x00000000 r11: 0x030bbc70 ip: 0x3b4061e0 sp: 0x030baa6c lr: 0x38b0393b pc: 0x38b03944 cpsr: 0x60000030
I am not very sure about this fix as i have not yet reproduced it at my end. If anyone at-least could help me out for reproducing then it would be great help :)
you do GUI changes in background thread but according to apple you are not changes in GUI in background thread...so use performSelectorOnMainThread to GUI change
This may be a result of calling to UIKit from a secondary thread.
Update the user interface on the main thread.In any of the case for doing UI updates in Separate thread reason will be invalid. One Option is Grand Central Dispatch as it do things in background threads and no crash at all.
My app is crashing when the user records a video and then clicks choose. Here is my code:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
//picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
picker.allowsEditing = NO;
picker.delegate = self;
picker.videoQuality = UIImagePickerControllerQualityTypeMedium;
[self presentModalViewController:picker animated:YES];
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// [self dismissModalViewControllerAnimated:YES];
AppDelegate *del = [[UIApplication sharedApplication]delegate];
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
moviePath = [[info objectForKey:UIImagePickerControllerMediaURL]path];..//using this for upload
del.globalMoviePath = moviePath;
if (CFStringCompare ((__bridge CFStringRef) mediaType, kUTTypeMovie, 0)== kCFCompareEqualTo)
{
moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
del.globalMoviePath = moviePath;
picker.videoMaximumDuration = 60.0f;
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
NSLog(#"nrgkrg===>%#",moviePath);
videoUrl=(NSURL*)[info objectForKey:UIImagePickerControllerMediaURL];
NSLog(#"Urlllll===>%#",videoUrl);
videoData = [NSData dataWithContentsOfURL:videoUrl];
del.globalMoviePath = moviePath;
NSLog(#"video is====>%#",del.globalMoviePath);
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoUrl];
UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
[player stop];
videoImage = [[UIImageView alloc]initWithImage:thumbnail];
//NSLog(#"imegsvideo====>%#",thumbnail);
//if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath))
//{
// UISaveVideoAtPathToSavedPhotosAlbum (moviePath, self, #selector(video:didFinishSavingWithError:contextInfo:), nil);
// }
//MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoUrl];
//UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
}
[self dismissModalViewControllerAnimated:YES];
//[[picker parentViewController] dismissModalViewControllerAnimated: YES];
}
When the user records a video and clicks choose app gets crashed but works fine when selected from camera roll.
Please help!!
Here's the log:
Nov 29 20:28:14 ReportCrash[259] <Notice>: Formulating crash report for process [254]
Nov 29 20:28:14 com.apple.launchd[1] <Warning>: (UIKitApplication:[0xcc37]) Job appears to have crashed: Segmentation fault: 11
Nov 29 20:28:14 backboardd[52] <Warning>: Application 'UIKitApplication:[0xcc37]' exited abnormally with signal 11: Segmentation fault: 11
Nov 29 20:28:14 ReportCrash[259] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Nov 29 20:28:14 ReportCrash[259] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/ using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) mstreamd: Checking on job state for Photo Stream
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) mstreamd: No jobs scheduled for Photo Stream.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) mstreamd: Checking on job state for Shared Stream
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) mstreamd: No jobs scheduled for Shared Stream.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) PS: Media stream daemon stopping.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSIOSAlbumSharingDaemon: 0x1ee72590>: Shared Streams daemon shutting down.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSIOSAlbumSharingDaemon: 0x1ee72590>: Shutting down state machine for personID 1446684163.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSASStateMachine: 0x1ed3e060>: Shutting down uploader.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSASStateMachine: 0x1ed3e060>: Shutting down downloader.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSASStateMachine: 0x1ed3e060>: Shutting down state machine.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSIOSAlbumSharingDaemon: 0x1ee72590>: Shutting down model.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSASServerSideModel: 0x1ed39d50>: Command Queue has shut down.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSIOSAlbumSharingDaemon: 0x1ee72590>: Model has shut down.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) AS: <MSIOSAlbumSharingDaemon: 0x1ee72590>: Shared Streams daemon has shut down.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Note ) mstreamd: <MSPowerBudget: 0x1ed394b0>: Stopping post-foreground timer.
Nov 29 20:28:38 mstreamd[257] <Notice>: (Warn ) mstreamd: mstreamd shutting down.
Nov 29 20:49:16 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state pluggedin_screen_off even though we are not in it, doing nothing
Nov 29 20:49:16 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableDetect 0
Nov 29 20:49:16 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableType Detached
Nov 29 20:49:16 kernel[0] <Debug>: virtual IOReturn AppleUSBDeviceMux::message(UInt32, IOService *, void *) - kMessageInterfaceWasDeActivated
Nov 29 20:49:16 kernel[0] <Debug>: AppleUSBDeviceMux::reportStats: USB mux statistics:
Nov 29 20:49:16 kernel[0] <Debug>: USB mux: 190 reads / 0 errors, 899 writes / 0 errors
Nov 29 20:49:16 kernel[0] <Debug>: USB mux: 0 short packets, 0 dups
Nov 29 20:49:16 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state pluggedin_charging even though we are not in it, doing nothing
Nov 29 20:49:16 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state unplugged_screen_off even though we are not in it, doing nothing
Nov 29 20:49:16 ptpd[104] <Notice>: PTP interface has been deactivated.
Nov 29 20:49:18 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state unplugged_asleep even though we are not in it, doing nothing
Nov 29 20:49:18 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableDetect 1
Nov 29 20:49:18 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableType USBHost
Nov 29 20:49:18 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state unplugged_screen_off even though we are not in it, doing nothing
Nov 29 20:49:18 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state pluggedin_screen_off even though we are not in it, doing nothing
Nov 29 20:49:19 ptpd[104] <Notice>: PTP interface has been activated at high speed.
Nov 29 20:49:56 lockdownd[29] <Notice>: 2fe93000 special_case_get: MGCopyAnswer(kMGQMobileEquipmentIdentifier) returned NULL
Nov 29 20:49:56 lockdownd[29] <Notice>: 2fe93000 copy_phonenumber: CTSettingCopyMyPhoneNumber() returned NULL
Nov 29 20:49:56 mobile_installation_proxy[265] <Error>: 0x3cbd7b88 MobileInstallationSlowLookupBreak: MobileInstallationBrowse was called without specifying an options dictionary containing kLookupReturnAttributesKey. This usage is inefficient and may cause performance problems. Break on MobileInstallationSlowLookupBreak to debug.
Nov 29 20:49:56 mobile_installation_proxy[265] <Error>: 0x3cbd7b88 MobileInstallationSlowLookupBreak: Existing options dictionary: <CFBasicHash 0x1c545b90 [0x3bfb1100]>{type = mutable dict, count = 1,
entries =>
6 : <CFString 0x1c545bc0 [0x3bfb1100]>{contents = "ApplicationType"} = <CFString 0x1c545b30 [0x3bfb1100]>{contents = "User"}
}
Nov 29 20:49:57 mc_mobile_tunnel[267] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Nov 29 20:49:57 mc_mobile_tunnel[267] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
Nov 29 20:49:57 mc_mobile_tunnel[268] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Nov 29 20:49:57 mc_mobile_tunnel[268] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
Nov 29 20:49:57 lockdownd[29] <Notice>: 2fe93000 set_response_error: handle_start_session SessionActive
Nov 29 20:49:57 lockdownd[29] <Notice>: 2fe93000 set_response_error: handle_start_session SessionActive
Nov 29 20:50:03 mc_mobile_tunnel[270] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Nov 29 20:50:03 mc_mobile_tunnel[270] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
Nov 29 20:51:31 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state pluggedin_screen_off even though we are not in it, doing nothing
Nov 29 20:51:31 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableDetect 0
Nov 29 20:51:31 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableType Detached
Nov 29 20:51:31 kernel[0] <Debug>: virtual IOReturn AppleUSBDeviceMux::message(UInt32, IOService *, void *) - kMessageInterfaceWasDeActivated
Nov 29 20:51:31 kernel[0] <Debug>: AppleUSBDeviceMux::reportStats: USB mux statistics:
Nov 29 20:51:31 kernel[0] <Debug>: USB mux: 195 reads / 0 errors, 493 writes / 0 errors
Nov 29 20:51:31 kernel[0] <Debug>: USB mux: 0 short packets, 0 dups
Nov 29 20:51:31 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state pluggedin_charging even though we are not in it, doing nothing
Nov 29 20:51:31 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state unplugged_screen_off even though we are not in it, doing nothing
Nov 29 20:51:31 ptpd[104] <Notice>: PTP interface has been deactivated.
Nov 29 20:51:41 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state unplugged_asleep even though we are not in it, doing nothing
Nov 29 20:51:41 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableDetect 1
Nov 29 20:51:41 kernel[0] <Debug>: AppleD1881PMUPowerSource: AppleUSBCableType USBHost
Nov 29 20:51:41 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state unplugged_screen_off even though we are not in it, doing nothing
Nov 29 20:51:41 UserEventAgent[13] <Warning>: PLAggregateState Error: Leaving state pluggedin_screen_off even though we are not in it, doing nothing
Nov 29 20:51:41 ptpd[272] <Error>: ptpd: startResponder
Nov 29 20:51:41 kernel[0] <Debug>: launchd[272] Builtin profile: ptpd (sandbox)
Nov 29 20:51:42 ptpd[272] <Notice>: PTP interface has been activated at high speed.
Nov 29 20:51:43 lockdownd[29] <Notice>: 2ffcf000 verify_pair_record: The strings don't match. Is this really a UUID?
Nov 29 20:51:43 lockdownd[29] <Notice>: 2ffcf000 store_escrow_record: Creating escrow bag (hash=9263ecf9c114f3a5cecdf7a52df193b4ce25044f) for 30264900-17792825678462560
Nov 29 20:51:52 lockdownd[29] <Notice>: 01442000 verify_pair_record: The strings don't match. Is this really a UUID?
Nov 29 20:51:52 lockdownd[29] <Notice>: 01442000 store_escrow_record: Creating escrow bag (hash=9de39584e1758f58137d28e4bd8c2fd79b5ba0a2) for 30264900-1682617038156454252
Nov 29 20:51:53 lockdownd[29] <Notice>: 01442000 special_case_get: MGCopyAnswer(kMGQMobileEquipmentIdentifier) returned NULL
Nov 29 20:51:53 lockdownd[29] <Notice>: 01442000 copy_phonenumber: CTSettingCopyMyPhoneNumber() returned NULL
Nov 29 20:51:53 mobile_installation_proxy[275] <Error>: 0x3cbd7b88 MobileInstallationSlowLookupBreak: MobileInstallationBrowse was called without specifying an options dictionary containing kLookupReturnAttributesKey. This usage is inefficient and may cause performance problems. Break on MobileInstallationSlowLookupBreak to debug.
Nov 29 20:51:53 mobile_installation_proxy[275] <Error>: 0x3cbd7b88 MobileInstallationSlowLookupBreak: Existing options dictionary: <CFBasicHash 0x1c5119d0 [0x3bfb1100]>{type = mutable dict, count = 1,
entries =>
6 : <CFString 0x1c511a00 [0x3bfb1100]>{contents = "ApplicationType"} = <CFString 0x1c511970 [0x3bfb1100]>{contents = "User"}
}
Nov 29 20:51:53 mc_mobile_tunnel[277] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Nov 29 20:51:53 mc_mobile_tunnel[277] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
Nov 29 20:51:53 mc_mobile_tunnel[278] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Nov 29 20:51:53 mc_mobile_tunnel[278] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
Nov 29 20:51:55 mc_mobile_tunnel[280] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Nov 29 20:51:55 mc_mobile_tunnel[280] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
Nov 29 20:52:01 iPhone4S mc_mobile_tunnel[282] <Notice>: (Note ) MC: mc_mobile_tunnel starting.
Nov 29 20:52:01 iPhone4S mc_mobile_tunnel[282] <Notice>: (Note ) MC: mc_mobile_tunnel shutting down.
this is because may be you are dismissing view just after dismissing picker:
[picker dismissModalViewControllerAnimated:YES];
[self dismissModalViewControllerAnimated:YES];
as you have used animated YES, the picker is not yet dismissed so either use new API
[picker dismissViewControllerAnimated:YES completion:^{
[self dismissModalViewControllerAnimated:YES];
}];
The App is crashes because in iOS6 [self dismissModalViewControllerAnimated:YES];
is deprecated you replace it with [picker dismissViewControllerAnimated:YES completion:nil]; may solve you issue.
I've submitted my app to appstore for review and is refused as follows:
We found that your app crashed on iPhone 4 running iOS 5.1.1, which is
not in compliance with the App Store Review Guidelines. Your app
crashed on launch on both Wi-Fi and cellular networks.
And this is the attached crash log:
Incident Identifier: 65E8D233-2F02-4545-85C9-74CA4A346051
CrashReporter Key: 5f5257827e93649c799893055b12d3d61c937314
Hardware Model: iPhone3,1
Process: iman360 [42785]
Path: /var/mobile/Applications/EA2B491A-194D-4669-ADF7-721593D2B14F/iman360.app/iman360
Identifier: iman360
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-08-09 13:41:37.107 -0700
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x2fdfe6e0
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 ??? 0x2fdfe6e0 0 + 803202784
1 iman360 0x00036ba2 -[ComicCatController refreshWithActionHandlerExeced:] (ComicCatController.m:216)
2 iman360 0x00036b0c -[ComicCatController refresh] (ComicCatController.m:207)
3 iman360 0x0002e682 -[TabComicCityViewController showSegTabView:] (TabComicCityViewController.m:312)
4 iman360 0x0002dcbc -[TabComicCityViewController segmentedViewValueChanged:] (TabComicCityViewController.m:96)
5 CoreFoundation 0x372ee3f6 -[NSObject performSelector:withObject:withObject:] + 46
6 UIKit 0x31083e00 -[UIApplication sendAction:to:from:forEvent:] + 56
7 UIKit 0x31083dbc -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24
8 UIKit 0x31083d9a -[UIControl sendAction:to:forEvent:] + 38
9 UIKit 0x31083b0a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 486
10 iman360 0x00019598 -[Iman360SegmentedView moveThumbToIndex:animate:] (Iman360SegmentedView.m:360)
11 iman360 0x00017ab4 -[Iman360SegmentedView willMoveToSuperview:] (Iman360SegmentedView.m:117)
12 UIKit 0x3106b502 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 390
13 UIKit 0x3106b370 -[UIView(Hierarchy) addSubview:] + 24
14 iman360 0x0002d996 -[TabComicCityViewController viewDidLoad] (TabComicCityViewController.m:49)
15 UIKit 0x310a1c84 -[UIViewController view] + 160
16 iman360 0x0001c86a +[ViewControllerManager initGlobalContentBgImgForViewController:] (ViewControllerManager.m:43)
17 iman360 0x0000422c -[Iman360ViewControllerBase init] (Iman360ViewControllerBase.m:25)
18 iman360 0x0002b8ce -[IndexTabViewControllerBase initWithIndexViewController:] (IndexTabViewControllerBase.m:19)
19 iman360 0x00004706 -[IndexViewController viewDidLoad] (IndexViewController.m:58)
20 UIKit 0x310a1c84 -[UIViewController view] + 160
21 UIKit 0x310a045a -[UIWindow addRootViewControllerViewIfPossible] + 38
22 UIKit 0x31224774 -[UIWindow setRootViewController:] + 332
23 iman360 0x0001c7da +[ViewControllerManager switchToViewController:] (ViewControllerManager.m:32)
24 iman360 0x0001c60a -[LoadingViewController onBackgroundJobFinishedWithUpdateInfo:] (LoadingViewController.m:165)
25 CoreFoundation 0x372f31f4 -[NSObject performSelector:withObject:] + 36
26 Foundation 0x37c0e740 __NSThreadPerformPerform + 344
27 CoreFoundation 0x37368acc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8
28 CoreFoundation 0x37368298 __CFRunLoopDoSources0 + 208
29 CoreFoundation 0x3736703e __CFRunLoopRun + 646
30 CoreFoundation 0x372ea49e CFRunLoopRunSpecific + 294
31 CoreFoundation 0x372ea366 CFRunLoopRunInMode + 98
32 GraphicsServices 0x33aa9432 GSEventRunModal + 130
33 UIKit 0x31096cce UIApplicationMain + 1074
34 iman360 0x00004d5c main (main.m:23)
35 iman360 0x00002e60 0x1000 + 7776
Thread 0 crashed with ARM Thread State:
r0: 0x2fdfe6bc r1: 0x2fdfe6bc r2: 0x2fdfe6e0 r3: 0x00000000
r4: 0x0015d980 r5: 0x00000001 r6: 0x00059384 r7: 0x2fdfe6e0
r8: 0x00059388 r9: 0x0000000e r10: 0x00153da0 r11: 0x314490ab
ip: 0x000249a1 sp: 0x2fdfe6e0 lr: 0x000249c1 pc: 0x2fdfe6e0
cpsr: 0x200f0010
But I've tested it on my iphone 4s & ipad, and it works well there. At first I thought it might be I am dereferencing a null pointer but KERN_PROTECTION_FAILURE at 0x2fdfe6e0 shows it is not so. Any idea on this?
I've make a static code analysis, and get something. That's stupid. I've forgot to call the [super init] method with some of my class initializer. But would anyone please help analyze if this is the problem? Not sure if this is where the problem is, as the app is still under review by appstore.
Fortunately, my app get passed this time. It is because I didn't call [super init] for my customized class object initialization. I'm just very curious about why this happens that it works well some times.
MPMoviePlayerController successfully plays airPlay when I go to the homescreen and app is in the background. But when i double tap the home button, the app crashes. This happens on iOS 5, but not is not on 4.3.
To exclude other code, I've created a new empty project that only executes the code bellow on button press.
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:#"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]];
NSError *setCategoryError = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController setMovieSourceType:MPMovieSourceTypeStreaming];
[self addObservers];
[self.delegate addSubview:moviePlayerController.view];
if([moviePlayerController respondsToSelector:#selector(setAllowsAirPlay:)])
{
[moviePlayerController setAllowsAirPlay:YES];
}
moviePlayerController.fullscreen = YES;
moviePlayerController.scalingMode = MPMovieScalingModeAspectFit;
[moviePlayerController prepareToPlay];
[moviePlayerController play];
In the console i get the following output on crash:
Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<< FIGSERVER >>>> FigPlayerRemoteServer_KillAndForceCrashReport: RPCTimeout message received to terminate [295] with reason 'fig rpc timeout -- FigSharedRemote_VolumeCategoryForAudioCategory'
Jan 27 12:08:01 unknown ReportCrash[308] <Notice>: MS:Notice: Installing: (null) [ReportCrash] (675.00)
Jan 27 12:08:01 unknown ReportCrash[308] <Error>: Saved crashreport to /Library/Logs/CrashReporter/mediaserverd-2012-01-27-120801.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<< FIGSERVER >>>> FigPlayerRemoteServer_KillAndForceCrashReport: RPCTimeout message received; stackshot generated
Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<< FIGSERVER >>>> FigPlayerRemoteServer_KillAndForceCrashReport: TERMINATING our process [295]
Jan 27 12:08:02 unknown com.apple.launchd[1] <Notice>: (com.apple.mediaserverd) Exited: Killed: 9
Jan 27 12:08:02 unknown mediaserverd[310] <Notice>: MS:Notice: Installing: com.apple.mediaserverd [mediaserverd] (675.00)
Jan 27 12:08:02 unknown kernel[0] <Debug>: Sandbox: ignoring builtin profile for platform app: /usr/sbin/mediaserverd
Jan 27 12:08:02 unknown kernel[0] <Debug>: Sandbox: ignoring builtin profile for platform app: /usr/sbin/mediaserverd
Jan 27 12:08:03 unknown mediaserverd[310] <Error>: 12:08:03.383370 com.apple.AVConference: /SourceCache/GameKitServices/GameKitServices-344.3/AVConference.subproj/Sources/AVConferenceServer.m:1862: AVConferenceServerStart aborting - device doesn't support conferencing
and in the crashreport:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x33bab8bf 0x33af2000 + 759999
1 libobjc.A.dylib 0x31bcd1e5 0x31bc4000 + 37349
2 AVFoundation 0x374f6cb5 -[AVPlayerItem _attachToPlayer:forImmediateEnqueueing:shouldAppendItem:] + 341
3 AVFoundation 0x374e71f7 -[AVPlayer _insertPlaybackItemOfItem:inPlayerQueueAfterPlaybackItemOfItem:] + 43
4 AVFoundation 0x374eebf3 __-[AVPlayer _attachItem:andPerformOperation:withObject:]_block_invoke_2 + 1099
5 libdispatch.dylib 0x3641cd55 0x3641c000 + 3413
6 libdispatch.dylib 0x36427e8d 0x3641c000 + 48781
7 CoreFoundation 0x33b7e2dd 0x33af2000 + 574173
8 CoreFoundation 0x33b014dd 0x33af2000 + 62685
9 CoreFoundation 0x33b013a5 0x33af2000 + 62373
10 GraphicsServices 0x31f56fcd 0x31f53000 + 16333
11 UIKit 0x36d57743 0x36d26000 + 202563
12 AirplayTest 0x00002e45 main (main.m:16)
13 AirplayTest 0x00002dd4 start + 40
Any clues what could be wrong?
Have you tried setting the useApplicationAudioSession property of your movie player controller to NO (i.e. to simulate iOS 3.1 default behaviour) for iOS 5 only? There seem to be some bugs around the audio session handling in iOS 5 that can cause the audio server to die when you switch between apps, handle interruptions etc.
If this fixes it, please submit a bug report to Apple, as it's more of a hack than a fix!
This seems to be a bug within iOS release 5.0. With the release of iOS 5.1 it seems to have been fixed.
Thanks to #Cyril for confirmation on this.
What does this error mean?
Nov 8 17:57:10 unknown configd[25] <Notice>: jetsam: kernel memory event (91), free: 670, active: 2840, inactive: 2253, purgeable: 0, wired: 15143
Nov 8 17:57:11 unknown SpringBoard[92] <Warning>: Received memory warning. Level=2
Nov 8 17:57:11 unknown MobileMail[6432] <Warning>: Received memory warning. Level=2
Nov 8 17:57:11 unknown configd[25] <Notice>: jetsam: kernel termination snapshot being created
Nov 8 17:57:11 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobileipod[0xe0a1]) Exited: Killed: 9
Nov 8 17:57:11 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilemail[0xbebe]) Exited: Killed: 9
Nov 8 17:57:11 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:paradigm.PaymentSystemiPad[0x6c80]) Bug: launchd_core_logic.c:3795 (24506):0
Nov 8 17:57:11 unknown DTMobileIS[6377] <Warning>: _memoryNotification : <NSThread: 0x1c5361d0>{name = (null), num = 1}
Nov 8 17:57:11 unknown com.apple.debugserver-50[6480] <Warning>: 1 [1950/1503]: error: ::read ( 4, 0x2ff669f0, 1024 ) => -1 err = Bad file descriptor (0x00000009)
Nov 8 17:57:11 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:paradigm.PaymentSystemiPad[0x6c80]) Bug: launchd_core_logic.c:3794 (24506):3
Nov 8 17:57:11 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:paradigm.PaymentSystemiPad[0x6c80]) Bug: launchd_core_logic.c:3202 (24506):10
Nov 8 17:57:11 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:paradigm.PaymentSystemiPad[0x6c80]) Working around 5020256. Assuming the job crashed.
Nov 8 17:57:11 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:paradigm.PaymentSystemiPad[0x6c80]) Job appears to have crashed: Segmentation fault: 11
Nov 8 17:57:11 unknown SpringBoard[92] <Warning>: Application 'Mail' exited abnormally with signal 9: Killed: 9
Nov 8 17:57:12 unknown DTMobileIS[6377] <Warning>: _memoryNotification : {
OSMemoryNotificationLevel = 0;
timestamp = "2011-11-08 12:27:11 +0000";
}
Nov 8 17:57:12 unknown DTMobileIS[6377] <Warning>: _memoryNotification : <NSThread: 0x1c5361d0>{name = (null), num = 1}
Nov 8 17:57:12 unknown DTMobileIS[6377] <Warning>: _memoryNotification : {
OSMemoryNotificationLevel = 0;
timestamp = "2011-11-08 12:27:12 +0000";
}
Nov 8 17:57:12 unknown SpringBoard[92] <Warning>: Application 'PaymentSystemiPad' exited abnormally with signal 11: Segmentation fault: 11
Nov 8 17:57:12 unknown SpringBoard[92] <Warning>: Application 'iPod' exited abnormally with signal 9: Killed: 9
Nov 8 17:57:12 unknown kernel[0] <Debug>: launchd[6486] Builtin profile: MobileMail (sandbox)
Nov 8 17:57:13 unknown ReportCrash[6485] <Error>: libMobileGestalt loadBasebandMobileEquipmentInfo: CommCenter error: 1:45
Nov 8 17:57:13 unknown ReportCrash[6485] <Error>: libMobileGestalt copyInternationalMobileEquipmentIdentity: Could not get mobile equipment info dictionary
Nov 8 17:57:13 unknown ReportCrash[6485] <Error>: Saved crashreport to /Library/Logs/CrashReporter/LowMemory-2011-11-08-175713.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
Nov 8 17:59:12 unknown SpringBoard[92] <Notice>: MultitouchHID(1f55bf50) uilock state: 0 -> 1
This mean that you have allocated a lot of memory and Received memory warning. I assume you have memory leaks or load many images/resources into memory. Try to research your code and find places where you load resources.