0
我的iOS視圖控制器崩潰在下面的這個方法(skipRegistration
)。它曾經工作過,但是現在每當蘋果嘗試批准該應用程序時它就會失敗。有沒有一種方法可以查看出了什麼問題,或調試崩潰的確切原因?視圖控制器崩潰 - 新手
代碼:
@interface MPRegisterViewController()
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
@end
@implementation MPRegisterViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
// for CoreData
MPAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
self.managedObjectContext = appDelegate.managedObjectContext;
self.firstName.delegate = self;
self.lastName.delegate = self;
self.email.delegate = self;
self.telephone.delegate = self;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Navigation
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[self.firstName resignFirstResponder];
[self.lastName resignFirstResponder];
[self.email resignFirstResponder];
[self.telephone resignFirstResponder];
return NO;
}
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
// Close the Mail Interface
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (IBAction)skipRegistration:(id)sender {
[[NSUserDefaults standardUserDefaults] setValue:@"skippedit" forKey: @"SkippedIt"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self dismissViewControllerAnimated:NO completion:NULL];
}
@end
我的堆棧跟蹤是在這裏;
完整堆棧跟蹤:
0的CoreFoundation 0x181d79e48 + 132 1 libobjc.A.dylib 0x1929c80e4 _objc_exception_throw + 60 2的UIKit 0x18683ea40 - [UIViewController中_presentViewController:withAnimationController:完成:] + 3376 3的UIKit 0x1868408dc + 120 4
的UIKit 0x1866160b4 - [UIViewController中 presentViewController:動畫:完成:] + 216
您是否測試過應用程序的發佈版本? – Wain
好吧,首先你應該得到異常消息。 –