Apple拒绝了我的应用程序(iPhone 5S上的操作系统版本7.1.2)并发送了崩溃日志。崩溃从未发生在我的测试设备上或模拟器中,因此我遇到了崩溃日志。我明白了,我必须象征崩溃日志。
这是我的第一个应用,所以我不确定我做错了什么:
我去了Organizer(Xcode 5.1.1),从Apple导入.crash文件,我得到的是以下内容:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x18441f100 0x184314000 + 1093888
1 libobjc.A.dylib 0x190dfc1fc 0x190df4000 + 33276
2 CoreFoundation 0x184320918 0x184314000 + 51480
3 MedSafe 0x1000596dc -[MRPatientenViewController done:] (MRPatientenViewController.m:396)
4 UIKit 0x18741d0b0 0x1873d4000 + 299184
5 UIKit 0x18741d0b0 0x1873d4000 + 299184
6 UIKit 0x18741d044 0x1873d4000 + 299076
7 UIKit 0x187406520 0x1873d4000 + 206112
8 UIKit 0x18741ca44 0x1873d4000 + 297540
9 UIKit 0x18741c6d8 0x1873d4000 + 296664
10 UIKit 0x187417370 0x1873d4000 + 275312
11 UIKit 0x1873e8b50 0x1873d4000 + 84816
12 UIKit 0x1873e6c40 0x1873d4000 + 76864
13 CoreFoundation 0x1843df7f4 0x184314000 + 833524
14 CoreFoundation 0x1843deb50 0x184314000 + 830288
15 CoreFoundation 0x1843dcde8 0x184314000 + 822760
16 CoreFoundation 0x18431ddd0 0x184314000 + 40400
17 GraphicsServices 0x189fbdc0c 0x189fb0000 + 56332
18 UIKit 0x18744efc4 0x1873d4000 + 503748
19 MedSafe 0x10008bdf4 main (main.m:16)
20 libdyld.dylib 0x1913efaa0 0x1913ec000 + 15008
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001914ea58c __pthread_kill + 8
1 libsystem_c.dylib 0x000000019147e804 abort + 108
2 libc++abi.dylib 0x00000001906a4990 abort_message + 84
3 libc++abi.dylib 0x00000001906c1c28 default_terminate_handler() + 296
4 libobjc.A.dylib 0x0000000190dfc4d0 _objc_terminate() + 124
5 libc++abi.dylib 0x00000001906bf164 std::__terminate(void (*)()) + 12
6 libc++abi.dylib 0x00000001906bed38 __cxa_rethrow + 140
7 libobjc.A.dylib 0x0000000190dfc3a4 objc_exception_rethrow + 40
8 CoreFoundation 0x000000018431de48 CFRunLoopRunSpecific + 572
9 GraphicsServices 0x0000000189fbdc08 GSEventRunModal + 164
10 UIKit 0x000000018744efc0 UIApplicationMain + 1152
11 MedSafe 0x000000010008bdf0 main (main.m:16)
12 libdyld.dylib 0x00000001913efa9c start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x00000001914d1aa8 kevent64 + 8
1 libdispatch.dylib 0x00000001913d5998 _dispatch_mgr_thread + 48
Thread 2:
0 libsystem_kernel.dylib 0x00000001914eae74 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000191569548 start_wqthread + 0
Thread 3:
0 libsystem_kernel.dylib 0x00000001914eae74 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000191569548 start_wqthread + 0
Thread 4:
0 libsystem_kernel.dylib 0x00000001914d1ca0 mach_msg_trap + 8
1 CoreFoundation 0x00000001843ded20 __CFRunLoopServiceMachPort + 180
2 CoreFoundation 0x00000001843dceb0 __CFRunLoopRun + 832
3 CoreFoundation 0x000000018431ddcc CFRunLoopRunSpecific + 448
4 CoreFoundation 0x0000000184373454 CFRunLoopRun + 108
5 CoreMotion 0x0000000184ad6538 0x184a98000 + 255288
6 libsystem_pthread.dylib 0x000000019156be18 _pthread_body + 164
7 libsystem_pthread.dylib 0x000000019156bd70 _pthread_start + 136
8 libsystem_pthread.dylib 0x0000000191569550 thread_start + 0
Thread 5:
0 libsystem_kernel.dylib 0x00000001914eae74 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000191569548 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x000000016fdd34d8
x4: 0x0000000000002060 x5: 0x000000016fdd3590 x6: 0x000000000000006e x7: 0x0000000000000640
x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x00000000943376f7 x11: 0x0000000000000300
x12: 0x0000000000000000 x13: 0x0000000000000000 x14: 0x0000000000000000 x15: 0x0000000191497dcb
x16: 0x0000000000000148 x17: 0x0000c5cd8043e48b x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x000000019434a2a0 x21: 0x434c4e47432b2b00 x22: 0x434c4e47432b2b00 x23: 0x0000000000000001
x24: 0x0000000178151b40 x25: 0x0000000000000001 x26: 0x0000000178002e00 x27: 0x00000001917fd410
x28: 0x0000000000000000 fp: 0x000000016fdd3510 lr: 0x000000019156d16c
sp: 0x000000016fdd34f0 pc: 0x00000001914ea58c cpsr: 0x00000000
Binary images....
我想,这意味着,该应用程序在MRPatientenViewController.m第396行崩溃。 但为什么没有更多的堆栈跟踪?我没有正确地进行符号化吗?
顺便说一句,这是崩溃的方法:- (IBAction)done:(id)sender {
if (debug==1) {
NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));
}
CoreDataHelper *cdh = [(MRMedSafeAppDelegate *) [[UIApplication sharedApplication] delegate] cdh];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
if ([self.callingSegue isEqualToString:@"add_patient"] || [self.callingSegue isEqualToString:@"add_patient_from_home"]) {
if ([self.vornameTextField.text isEqualToString:@("")]) {
// kein Vorname, zeige Alert, dass Vorname eingegeben werden muss, und abbrechen
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Vorname fehlt!"
message:@"Bitte Vorname eingeben."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
return;
}
if ([self.nachnameTextField.text isEqualToString:@("")]) {
// kein Nachname, zeige Alert, dass Vorname eingegeben werden muss, und abbrechen
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Nachname fehlt!"
message:@"Bitte Nachname eingeben."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
return;
}
if ([_dateTextField.text isEqualToString:@""]){
// kein Geburtsdatum, zeige Alert, dass Geburtsdatum eingegeben werden muss, und abbrechen
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Geburtdatum fehlt!"
message:@"Bitte Geburtsdatum eingeben."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
return;
}
NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
if ([emailTest evaluateWithObject:self.emailTextField.text] == NO && (![self.emailTextField.text isEqualToString:@""])) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Inkorrekte Email-Addresse!"
message:@"Bitte geben Sie eine korrekte oder keine Email-Addresse ein."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return;
}
if ([_krankenkassenTextField.text isEqualToString:@""]) {
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Krankenkasse fehlt!"
message:@"Bitte Krankenkasse wählen."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
return;
}
// check if we can create a local reminder calender for medicaments
if(![self createLocalCalendarForMedicamentReminders]){
// No calendar created
NSLog(@"No Calendar created.");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Kein Kalendar erstellt!"
message:@"Es konnte kein Kalendar für Medikament-Erinnerungen erstellt werden. Bitte aktivieren Sie -> Einstellungen -> iCloud -> Erinnerungen."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return;
}
// check if we can create a local reminder calender for impfungen
if(![self createLocalCalendarForImpfungReminders]){
// No calendar created
NSLog(@"No Calendar created.");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Kein Kalendar erstellt!"
message:@"Es konnte kein Kalendar für Impfung-Erinnerungen erstellt werden. Bitte aktivieren Sie -> Einstellungen -> iCloud -> Erinnerungen."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return;
}
Patient *patient = [NSEntityDescription insertNewObjectForEntityForName:@"Patient" inManagedObjectContext:[cdh context]];
patient.vorname = self.vornameTextField.text;
patient.nachname = self.nachnameTextField.text;
patient.reminder_calendar_id = _medikamentCalendarId;
patient.reminder_calendar_title = _medikamentCalendarTitle;
patient.reminder_impfungen_calendar_id = _impfungCalendarId;
patient.reminder_impfungen_calendar_title = _impfungCalendarTitle;
patient.email = self.emailTextField.text;
patient.geburtsdatum = _datePicker.date;
patient.erinnern_med_verbraucht = [NSNumber numberWithBool:YES];
patient.erinnern_med_tage = [NSNumber numberWithInt:7];
patient.erinnern_med_minute = [NSNumber numberWithInt:0];
patient.erinnern_med_stunde = [NSNumber numberWithInt:10];
patient.versichertennummer = _versichertenNummerTextField.text;
if (self.genderSegmentedControl.selectedSegmentIndex == 0) {
patient.weiblich = [NSNumber numberWithBool:NO];
} else {
patient.weiblich = [NSNumber numberWithBool:YES];
}
patient.krankenkasse = [self.krankenkassenArray objectAtIndex:[_krankenkassenPickerView selectedRowInComponent:0]];
// because this is a new profile, there is no need to delete the old file
// save the new file under unique name which is in imageName
patient.imagename = self.imageName;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
[self saveImage:self.userImageView.image byName:self.imageName inDirectory:documentsDirectory];
[cdh saveContext];
NSArray *einnahmeZeiten = [self fetchEinnahmeZeiten];
for (EinnahmeZeit *einnahmeZeit in einnahmeZeiten) {
NSLog(@"einnahmeZeit: %@", einnahmeZeit);
PatientEinnahmeZeit *patientEinnahmeZeit = [NSEntityDescription insertNewObjectForEntityForName:@"PatientEinnahmeZeit" inManagedObjectContext:[cdh context]];
patientEinnahmeZeit.patient = patient;
NSString *name = einnahmeZeit.name;
patientEinnahmeZeit.name = name;
int ordinal = [einnahmeZeit.ordinal intValue];
int minute = [einnahmeZeit.minute intValue];
int stunde = [einnahmeZeit.stunde intValue];
patientEinnahmeZeit.ordinal = [NSNumber numberWithInt:ordinal];
patientEinnahmeZeit.minute = [NSNumber numberWithInt:minute];
patientEinnahmeZeit.stunde = [NSNumber numberWithInt:stunde];
[cdh saveContext];
}
MRSingleton *singleton = [MRSingleton sharedMRSingleton];
[singleton saveCurrentPatient:patient];
//[cdh saveContext];
MRHomeViewController *hvc = (MRHomeViewController *)self.delegate;
hvc.patientJustAdded = YES;
hvc.aufgabenArray = nil;
[hvc.aufgabenTableView reloadData];
[hvc fetchAufgabenInBackground];
[self.delegate dismissViewControllerAnimated:YES completion:nil];
} else if ([self.callingSegue isEqualToString:@"edit_patient"] || [self.callingSegue isEqualToString:@"edit_patient_from_acc"]) {
if ([self.vornameTextField.text isEqualToString:@("")]) {
// kein Vorname, zeige Alert, dass Vorname eingegeben werden muss, und abbrechen
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Vorname fehlt!"
message:@"Bitte Vorname eingeben."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
return;
}
if ([self.nachnameTextField.text isEqualToString:@("")]) {
// kein Nachname, zeige Alert, dass Vorname eingegeben werden muss, und abbrechen
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Nachname fehlt!"
message:@"Bitte Nachname eingeben."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
return;
}
if ([_krankenkassenTextField.text isEqualToString:@""]) {
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Krankenkasse fehlt!"
message:@"Bitte Krankenkasse wählen."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
return;
}
NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
if ([emailTest evaluateWithObject:self.emailTextField.text] == NO && (![self.emailTextField.text isEqualToString:@""])) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Inkorrekte Email-Addresse!"
message:@"Bitte geben Sie eine korrekte oder keine Email-Addresse ein."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return;
}
// check if there is already a patient with this nachname, vorname and geburtsdatum
NSArray *patients = [self fetchPatientWithNachname:self.nachnameTextField.text andVorname:self.vornameTextField.text andGeburtsdatum:self.datePicker.date];
NSLog(@"patients count: %d", [patients count]);
if ([patients count] > 0) {
Patient *duplicate = [patients objectAtIndex:0];
NSLog(@"duplicate objectID: %@", [duplicate objectID]);
NSLog(@"self.selectedObjectID: %@", self.selectedObjectID);
if (![[duplicate objectID] isEqual:self.selectedObjectID]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Patient existiert bereits!"
message:@"Es existiert bereits ein Patient mit diesem Nachnamen, Vornamen und Geburtsdatum."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
return;
}
}
Patient *patient = (Patient *)[cdh.context existingObjectWithID:self.selectedObjectID error:nil];
patient.vorname = self.vornameTextField.text;
patient.nachname = self.nachnameTextField.text;
patient.email = self.emailTextField.text;
patient.geburtsdatum = _datePicker.date;
patient.versichertennummer = _versichertenNummerTextField.text;
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
if (self.genderSegmentedControl.selectedSegmentIndex == 0) {
patient.weiblich = [NSNumber numberWithBool:NO];
} else {
patient.weiblich = [NSNumber numberWithBool:YES];
}
patient.krankenkasse = [self.krankenkassenArray objectAtIndex:[self.krankenkassenPickerView selectedRowInComponent:0]];
// check if there if a new image was picked
if (self.imageChanged) {
// because this is an existing profile, we need to save the file and delete the old file
NSString *oldFilename = patient.imagename;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
// delete old file
[self deleteImageByName:oldFilename inDirectory:documentsDirectory];
// save the new file
[self saveImage:self.userImageView.image byName:self.imageName inDirectory:documentsDirectory];
patient.imagename = self.imageName;
} else {
//
}
[cdh saveContext];
[self.navigationController popViewControllerAnimated:YES];
} else {
NSLog(@"Unknown calling segue");
}
}
第396行是:
patient.krankenkasse = [self.krankenkassenArray objectAtIndex:[_krankenkassenPickerView selectedRowInComponent:0]];
有什么建议吗?