(ios9) HangTracer 间隔为 0,强制为 1s,同时使用 Contact Framework
(ios9) HangTracer interval is 0, forcing to 1s, while using Contact Framework
我正在使用 Contact Framework(只是添加一个联系人)。它被保存没有任何问题(我仔细检查了联系人列表)但最近我注意到这条消息出现在控制台上:
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
我在谷歌上搜索了一下,只在 Twitter 上发现了一个关于“这是什么新魔法?”的提及。
其实我不知道是不是我的代码导致了这个问题
-(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;
}
}
在 NSLog
上使用断点进行调试会调用 [UIApplication startHangtracer:]
。这发生在 HTStartHangTracing
.
下的线程中
它自 iOS 9 以来发生,并且它来自 UIApplication
,这让我对 Apple 在 iOS 9 中的新错误报告框架产生了强烈的感觉。
这可能只是关于检测应用程序何时挂起的部分。
有人应该调查通过 TestFlight 分发的应用程序错误报告,以确认此 HangTracer
是其中的一部分。
我正在使用 Contact Framework(只是添加一个联系人)。它被保存没有任何问题(我仔细检查了联系人列表)但最近我注意到这条消息出现在控制台上:
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
我在谷歌上搜索了一下,只在 Twitter 上发现了一个关于“这是什么新魔法?”的提及。
其实我不知道是不是我的代码导致了这个问题
-(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;
}
}
在 NSLog
上使用断点进行调试会调用 [UIApplication startHangtracer:]
。这发生在 HTStartHangTracing
.
它自 iOS 9 以来发生,并且它来自 UIApplication
,这让我对 Apple 在 iOS 9 中的新错误报告框架产生了强烈的感觉。
这可能只是关于检测应用程序何时挂起的部分。
有人应该调查通过 TestFlight 分发的应用程序错误报告,以确认此 HangTracer
是其中的一部分。