I was working with Contact Framework (just adding a contact). And It was saved without any problem (I double checked in Contact List) but recently I notice that this message appears on console:
2015-06-12 09:57:39.723 AddingContactToAddressBook[819:291346] HangTracer interval is 0, forcing to 1s
2015-06-12 09:57:39.725 AddingContactToAddressBook[819:291346] made new hangtracer connection:0x332e10
I googled it and I only found a mention in Twitter, about “What new wizardry is this?”.
Actually, I don’t know if my code is the cause of this problem.
-(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;
}
}
Debugging with a breakpoint on NSLog
gives a call to [UIApplication startHangtracer:]
. This occurs in the thread under HTStartHangTracing
.
Th fact that it occurs since iOS 9, and that it is from within UIApplication
, gives me a strong feeling towards Apple's new bug reporting framework in iOS 9.
This might just be the part about detecting when an application hangs.
Someone should investigate their app bugreports when distributed through TestFlight, to confirm that this HangTracer
is part of that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With