简体   繁体   中英

ABUnknownPersonViewController crashes

Im using this code to show an ABUnknowPersonViewController for showing a record from a person which was created from a vCard String:

- (ABRecordRef)person {
    if (person == NULL) {
        ABPersonCreator *creator = [[ABPersonCreator alloc] initWithVcardString:vcardString];

        person = creator.person;
        CFRetain(person);

        [creator release];  
    }

    return person;
}

- (UIView *)fullscreenView {
    unknownPersonController = [[ABUnknownPersonViewController alloc] init];

unknownPersonController.displayedPerson = self.person;
    unknownPersonController.allowsAddingToAddressBook = YES;
    unknownPersonController.allowsActions = YES;
    unknownPersonController.unknownPersonViewDelegate = self;
    return unknownPersonController.view;
}

Can someone help me out with this?

thx Philip

The solution to this problem for me was that I wasn't passing the right stuff when building the ABRecordRef. For instance, I tried to simply set a string to a property when it instead wanted a kABMultiStringPropertyType. The exception would only occur after trying to launch the UnknownPersonViewController.

Check your datatypes and make sure that you're building the right thing.

不应让unknownPersonViewController具有自动释放功能,因为它已返回视图?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM