Ios 视图控制器崩溃-新手
我的iOS视图控制器因下面的此方法而崩溃(Ios 视图控制器崩溃-新手,ios,objective-c,viewcontroller,Ios,Objective C,Viewcontroller,我的iOS视图控制器因下面的此方法而崩溃(skipRegistration)。它过去可以工作,但现在每当苹果试图批准该应用程序时,它都会失败。有没有一种方法可以让我看到问题所在,或者调试崩溃的确切原因 代码: 我的堆栈跟踪在这里 完整堆栈跟踪: 0芯基础0x181d79e48+132 1 libobjc.A.dylib 0x1929c80e4_objc_exception_throw +60 2 UIKit 0x18683ea40-[UIViewController\u presentViewC
skipRegistration
)。它过去可以工作,但现在每当苹果试图批准该应用程序时,它都会失败。有没有一种方法可以让我看到问题所在,或者调试崩溃的确切原因
代码:
我的堆栈跟踪在这里
完整堆栈跟踪:
0芯基础0x181d79e48+132 1
libobjc.A.dylib 0x1929c80e4_objc_exception_throw
+60 2 UIKit 0x18683ea40-[UIViewController\u presentViewController:带动画控制器:完成:+3376 3 UIKit 0x1868408dc+120 4UIKit 0x1866160b4-[UIVIEW控制器 presentViewController:动画:完成::+216
您的
skippregration
的最后一行似乎是罪魁祸首,视图是如何呈现的?我会把你的注意力集中在这里 你测试过应用的发布版本吗?首先,你应该得到异常消息。
@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