Hi there,

I'm new to both C# and iOS and I'm looking for an example of how to
implement ABAddressBook.RequestAccess. Here is my code so far:

private bool GetAddressBook ()
{
        if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0)) {
                NSError err;
                iPhoneAddressBook = ABAddressBook.Create (out err);
                var authStatus = ABAddressBook.GetAuthorizationStatus();
                if (authStatus != ABAuthorizationStatus.Authorized) {
                        // iPhoneAddressBook.RequestAccess <-- is this where to 
do it?? how??
                        using (var alert = new UIAlertView("Contacts 
Permission", "We need your
permission to access your phone contacts. Please go to Settings > Privacy >
Contacts", null, "OK", null)) {
                                alert.Show ();  
                                return false;
                        }
                }
                return err == null;
        } else {
                iPhoneAddressBook = new ABAddressBook ();
                return true;
        }
}

Thanks for your help guys.




--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/iOS-6-ABAddressBook-RequestAccess-example-tp4657314.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to