Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5   8.6    Statistic  

CNContactStore.RequestAccesss

Request access to the user's contacts.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Contacts 8.4 Yes No No No Yes
MBS( "CNContactStore.RequestAccesss" )   More

Parameters

none

Result

Returns OK or error.

Description

Request access to the user's contacts.
Users are able to grant or deny access to contact data on a per-application basis. To request access to contact data, call CNContactStore.RequestAccesss function. This will not block the application while the user is being asked to grant or deny access. The user will only be prompted the first time access is requested; any subsequent ContactStore calls will use the existing permissions.

Later you can use CNContactStore.AuthorizationStatus to check status or CNContactStore.AuthorizationError to learn why you didn't get permissions.

The application needs to be code signed with entitlements with com.apple.security.personal-information.addressbook identifier. See also my idea here:
https://community.filemaker.com/ideas/3240

Examples

Request access:

Set Variable [$r; Value: MBS( "CNContactStore.RequestAccesss" ) ]

Request authorization with some error checking:

Set Variable [ $r ; Value: MBS( "CNContactStore.RequestAccesss" ) ]
Pause/Resume Script [ Duration (seconds): 1 ]
Set Variable [ $r ; Value: MBS( "CNContactStore.AuthorizationError" ) ]
If [ Length($r) > 0 ]
    Show Custom Dialog [ "Error" ; $r ]
End If
Set Variable [ $groups ; Value: MBS( "CNContactStore.Groups" ) ]
If [ Length ( $groups ) = 0 ]
    Show Custom Dialog [ "Possible Problem" ; "Either you have no groups or you did not code sign the app?" ]
End If

See also

Example Databases

Created 1st August 2018, last changed 6th August 2018


CNContactStore.RenameGroup   -   CNContactStore.SetChangeScript

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins