[ 
https://issues.apache.org/jira/browse/CB-7865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14185134#comment-14185134
 ] 

Aleksey Dobrushin commented on CB-7865:
---------------------------------------

Found the solution, but I think it should be the part of plugin.
following code should be added to initWithWebView function:
{code}
    if (ABAddressBookGetAuthorizationStatus() == 
kABAuthorizationStatusNotDetermined) {
        ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool 
granted, CFErrorRef error) {
            if (granted) {
                // If the app is authorized to access the first time then add 
the contact
            } else {
                // Show an alert here if user denies access telling that the 
contact cannot be added because you didn't allow it to access the contacts
            }
        });
    }
{code}

Without this code if you look at permissions for your application Contacts is 
not listed. This is of course nice change from iOS that contact picker could 
work without having access to Contacts (sounds strange), but picker returns 
only copy of the contact record, without id and image data.

Please note, if you have app previously installed on iPad, it remembers contact 
could be accessed from app. But in my case - new iPad and newly installed 
application - now it should request access to Contacts.

> [Contacts] pickContact does not return contact id and photo
> -----------------------------------------------------------
>
>                 Key: CB-7865
>                 URL: https://issues.apache.org/jira/browse/CB-7865
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 3.5.0
>         Environment: MacOS, XCode, iPad3 with iOS 8.0.2
>            Reporter: Aleksey Dobrushin
>
> pickContact function of Contact plugin does not return contact image (photo) 
> and id.
> I did some debugging - didSelectPerson handler of 
> ABPeoplePickerNavigationController:  
> - ABRecordGetRecordID(person)   returns always -1
> - in CDVContact.extractPhotos method ABPersonHasImageData returns always 
> false, even for contacts which has photos



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to