Stavo lavorando con Contact Framework (aggiungendo semplicemente un contatto). E 'stato salvato senza alcun problema (Ho ricontrollato in lista dei contatti), ma di recente ho notato che questo messaggio appare sulla console:(ios9) L'intervallo HangTracer è 0, forzato a 1 secondo, mentre si utilizza Contact Framework
2015-06-12 09: 57: 39,723 AddingContactToAddressBook [819: 291346] HangTracer intervallo è 0, costringendo a 1s
2015/06/12 09: 57: 39,725 AddingContactToAddressBook [819: 291346] fatto nuovi hangtracer collegamento: 0x332e10
googled e ho trovato solo una menzione in Twitter, su "Che nuova magia è t il suo?".
In realtà, non so se il mio codice è la causa di questo problema.
-(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;
}
}
Ora viene visualizzato questo messaggio: "2015-06-12 10: 12: 12,943 AggiungiContactToAddressBook [824: 293782] Arresto HangTracer" – Jadekin
Grazie per aver chiesto, "magia" si adatta perfettamente qui. – LinusGeffarth