MFMessageComposeViewController crashes MessagesViewService when using UIEdgeInsets appearance

Originator:mattias.wadman
Number:rdar://15413818 Date Originated:2013-11-07
Status:Open Resolved:
Product:iOS Product Version:7.0.3
Classification:Crash Reproducible:Yes
 
Summary:
If you build an app with only 32 bit support and then run on a 64 bit device like a 5s and use MFMessageComposeViewController together with a UIEdgeInsets appearance setting the MessagesViewService will crash.

Steps to Reproduce:
1. Build included test app
2. Run on 64 bit device

Expected Results:
Should show MFMessageComposeViewController

Actual Results:
Does not MFMessageComposeViewController and MessagesViewService crashes.

Version:
iOS 7.0.3

Sample app:

AppDelegate.h:
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end


AppDelegate.m:
// Compile with armv7, arm7s etc but exclude arm64. Then run on 64 bit device like 5s.

// MFMessageComposeViewController seems to be a remote view controller handled by
// MessagesViewService. The UIApperenace settings are replicated over to MessagesViewService
// but there is some kind of mismatch for UIEdgeInsets apperance proprties.
// MessagesViewService runs as 64 bit i guess.

// app log:
// init Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)"
// Remote compose controller timed out (NO)!

// console log:
/*
MessagesViewService[185] <Warning>: *** Assertion failure in -[_UIAppearanceRecorder _applyCustomizations](), /SourceCache/UIKit/UIKit-2903.2/UIAppearance.m:1877
MessagesViewService[185] <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Illegal property type, {UIEdgeInsets=ffff}'
*** First throw call stack:
(0x182b7709c 0x18ea91d78 0x182b76f5c 0x1836a3420 0x185f5e938 0x186063a6c 0x185ff24f8 0x182b7b810 0x182a94dfc 0x182a99654 0x186047e64 0x182b7988c 0x182a994ec 0x182b7b810 0x182a94dfc 0x182a99654 0x18600f144 0x182b7988c 0x182a994ec 0x182b7b810 0x182a94dfc 0x182a99654 0x182b7988c 0x182a994ec 0x182b7b810 0x182a94dfc 0x18f06043c 0x18f0603fc 0x18f063578 0x182b36d64 0x182b350a4 0x182a75b78 0x188497830 0x185ab305c 0x100073d80 0x18f07baa0)
ReportCrash[186] <Notice>: ReportCrash acting against PID 185
ReportCrash[186] <Notice>: Formulating crash report for process MessagesViewService[185]
com.apple.launchd[1] (UIKitApplication:com.apple.mobilesms.compose[0x5c33][185]) <Warning>: (UIKitApplication:com.apple.mobilesms.compose[0x5c33]) Job appears to have crashed: Abort trap: 6
App[181] <Warning>: init Error Domain=NSCocoaErrorDomain Code=4097 "The operation couldn’t be completed. (Cocoa error 4097.)"
App[181] <Warning>: Remote compose controller timed out (NO)!
backboardd[31] <Warning>: Application 'UIKitApplication:com.apple.mobilesms.compose[0x5c33]' exited abnormally with signal 6: Abort trap: 6
ReportCrash[186] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MessagesViewService_2013-11-06-175025_iPhone.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
*/

// MessageViewService crash backtrace:
/*
 Last Exception Backtrace:
 0   CoreFoundation                	0x188b7b09c __exceptionPreprocess + 132
 1   libobjc.A.dylib               	0x194a95d78 objc_exception_throw + 60
 2   CoreFoundation                	0x188b7af5c +[NSException raise:format:arguments:] + 116
 3   Foundation                    	0x1896a7420 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 88
 4   UIKit                         	0x18bf62938 -[_UIAppearanceRecorder _applyCustomizations] + 2088
 5   UIKit                         	0x18c067a6c UIViewServiceUpdateAppearanceWithSerializedRepresentations + 404
 6   UIKit                         	0x18bff64f8 -[_UIViewServiceViewControllerOperator __createViewController:withAppearanceSerializedRepresentations:legacyAppearance:hostAccessibilityServerPort:canShowTextServices:replyHandler:] + 848
 7   CoreFoundation                	0x188b7f810 __invoking___ + 144
 8   CoreFoundation                	0x188a98dfc -[NSInvocation invoke] + 308
 9   CoreFoundation                	0x188a9d654 -[NSInvocation invokeWithTarget:] + 72
 10  UIKit                         	0x18c04be64 -[_UIViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 252
 11  CoreFoundation                	0x188b7d88c ___forwarding___ + 416
 12  CoreFoundation                	0x188a9d4ec __forwarding_prep_0___ + 92
 13  CoreFoundation                	0x188b7f810 __invoking___ + 144
 14  CoreFoundation                	0x188a98dfc -[NSInvocation invoke] + 308
 15  CoreFoundation                	0x188a9d654 -[NSInvocation invokeWithTarget:] + 72
 16  UIKit                         	0x18c013144 -[_UIQueueingProxy forwardInvocation:] + 344
 17  CoreFoundation                	0x188b7d88c ___forwarding___ + 416
 18  CoreFoundation                	0x188a9d4ec __forwarding_prep_0___ + 92
 19  CoreFoundation                	0x188b7f810 __invoking___ + 144
 20  CoreFoundation                	0x188a98dfc -[NSInvocation invoke] + 308
 21  CoreFoundation                	0x188a9d654 -[NSInvocation invokeWithTarget:] + 72
 22  CoreFoundation                	0x188b7d88c ___forwarding___ + 416
 23  CoreFoundation                	0x188a9d4ec __forwarding_prep_0___ + 92
 24  CoreFoundation                	0x188b7f810 __invoking___ + 144
 25  CoreFoundation                	0x188a98dfc -[NSInvocation invoke] + 308
 26  libdispatch.dylib             	0x19506443c _dispatch_call_block_and_release + 24
 27  libdispatch.dylib             	0x1950643fc _dispatch_client_callout + 16
 28  libdispatch.dylib             	0x195067578 _dispatch_main_queue_callback_4CF + 344
 29  CoreFoundation                	0x188b3ad64 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
 30  CoreFoundation                	0x188b390a4 __CFRunLoopRun + 1452
 31  CoreFoundation                	0x188a79b78 CFRunLoopRunSpecific + 452
 32  GraphicsServices              	0x18e49b830 GSEventRunModal + 168
 33  UIKit                         	0x18bab705c UIApplicationMain + 1156
 34  MessagesViewService           	0x1000d3d80 0x1000d0000 + 15744
 35  libdyld.dylib                 	0x19507faa0 start + 4
*/

#import "AppDelegate.h"
#import <MessageUI/MessageUI.h>

@interface AppDelegate () <MFMessageComposeViewControllerDelegate>
@end

@implementation AppDelegate

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller
                 didFinishWithResult:(MessageComposeResult)result
{    
    [controller dismissViewControllerAnimated:YES completion:NULL];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    id appearance = [UIButton appearance];
    [appearance setContentEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [self.window  makeKeyAndVisible];
    self.window.rootViewController = [[UINavigationController alloc]
                                      initWithRootViewController:[[UIViewController alloc] init]];
    
    MFMessageComposeViewController *composerViewController = [[MFMessageComposeViewController alloc] init];
    composerViewController.messageComposeDelegate = self;
    [self.window.rootViewController presentViewController:composerViewController
                                                 animated:YES
                                               completion:NULL];

    return YES;
}

@end

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!