Ich arbeitete mit Contact Framework (nur einen Kontakt hinzufügen). Und es war ohne Probleme gespeichert (I doppelt in Kontaktliste überprüft), aber vor kurzem merke ich, dass diese Meldung auf der Konsole angezeigt:(ios9) HangTracer-Intervall ist 0, erzwungen zu 1s, während Contact Framework
2015-06-12 09: 57: 39,723 AddingContactToAddressBook [819: 291346] HangTracer Intervall 0, zwingt zu 1s
2015-06-12 09: 57: 39,725 AddingContactToAddressBook [819: 291346] haben neuen hangtracer Verbindung: 0x332e10
ich es gegoogelt und ich fand nur eine Erwähnung in Twitter, über "Was neue Zauberei ist t seine?".
Eigentlich, ich weiß nicht, ob mein Code die Ursache dieses Problems ist.
-(void)verifyUserAuthorizationInIOS9andLower{
CNContactStore * contactStore = [[CNContactStore alloc]init];
if ([CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusNotDetermined) {
[contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * __nullable error) {
if (granted==YES) {
[self addContactInIOS9andLower];
if ([self addContactInIOS9andLower]) {
NSLog(@"Error");
}
else{
NSLog(@"Error");
}
}
else{
NSLog(@"Error");
}
}];
}
else if ([CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusAuthorized){
[self addContactInIOS9andLower];
}
else {
NSLog(@"Error");
}
}
-(BOOL)addContactInIOS9andLower{
CNContactStore * contactStore = [[CNContactStore alloc]init];
CNMutableContact *mutableContact = [[CNMutableContact alloc]init];
mutableContact.givenName = name;
mutableContact.familyName = lastname;
mutableContact.phoneNumbers = [[NSArray alloc]initWithObjects:[CNLabeledValue labeledValueWithLabel:CNLabelPhoneNumberiPhone value:[CNPhoneNumber phoneNumberWithStringValue:phone]], nil];
CNSaveRequest * saveRequest = [[CNSaveRequest alloc]init];
[saveRequest addContact:mutableContact toContainerWithIdentifier:nil];
NSError *error = nil;
if ([contactStore executeSaveRequest:saveRequest error:&error]){
return NO;
}
else{
return YES;
}
}
Jetzt Diese Nachricht erscheint: "2015-06-12 10: 12: 12.943 AddingContactToAddressBook [824: 293782] Stoppen HangTracer" – Jadekin
Danke für die Frage, "Zauberei" passt perfekt hier. – LinusGeffarth