gpt4 book ai didi

iOS8 在重定向到 ABPersonViewController 时崩溃 [Not A Type retain] : message sent to deallocated instance

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:20:26 24 4
gpt4 key购买 nike

ABPersonViewController *personController = [[ABPersonViewController alloc] init];
personController.personViewDelegate = self;
ABRecordRef person = ABAddressBookGetPersonWithRecordID(personController.addressBook, [recordID intValue]);
personController.displayedPerson = person;
personController.allowsEditing = YES;
personController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back",nil) style:UIBarButtonItemStylePlain target:self action:@selector(returnFromPersonView)] ;
personController.navigationController.navigationBarHidden = NO;

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:personController];
navController.navigationBar.tintColor=[UIColor colorWithRed:27/255.0 green:27/255.0 blue:29/255.0 alpha:1.0];
[self presentViewController:navController animated: YES completion:nil];

在这一行 personController.displayedPerson = person; 中崩溃作为[Not A Type retain]: 发送到释放实例的消息

最佳答案

尝试不从 Controller 获取 addressBook,而是显式地创建它:

ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, &err);
ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, [recordID intValue]);

关于iOS8 在重定向到 ABPersonViewController 时崩溃 [Not A Type retain] : message sent to deallocated instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26053390/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com