Пример #1
0
        static InitConstants()
        {
#if __MACCATALYST__
            // avoid TypeLoadException if used before macOS 11.x
            if (!UIKit.UIDevice.CurrentDevice.CheckSystemVersion(14, 0))
            {
                return;
            }
#endif
            // ensure we can init. This is needed before iOS6 (as per doc).
            IntPtr p = ABAddressBook.ABAddressBookCreate();

            ABGroupProperty.Init();
            ABLabel.Init();
            ABPersonAddressKey.Init();
            ABPersonDateLabel.Init();
            ABPersonInstantMessageKey.Init();
            ABPersonInstantMessageService.Init();
            ABPersonKindId.Init();
            ABPersonPhoneLabel.Init();
            ABPersonPropertyId.Init();
            ABPersonRelatedNamesLabel.Init();
            ABPersonUrlLabel.Init();
            ABSourcePropertyId.Init();

            // From iOS 6.0+ this might return NULL, e.g. if the application is not authorized to access the
            // address book, and we would crash if we tried to release a null pointer
            if (p != IntPtr.Zero)
            {
                CFObject.CFRelease(p);
            }
        }
Пример #2
0
        static InitConstants()
        {
            // ensure we can init. This is needed before iOS6 (as per doc).
            IntPtr p = ABAddressBook.ABAddressBookCreate();

            ABGroupProperty.Init();
            ABLabel.Init();
            ABPersonAddressKey.Init();
            ABPersonDateLabel.Init();
            ABPersonInstantMessageKey.Init();
            ABPersonInstantMessageService.Init();
            ABPersonKindId.Init();
            ABPersonPhoneLabel.Init();
            ABPersonPropertyId.Init();
            ABPersonRelatedNamesLabel.Init();
            ABPersonUrlLabel.Init();
            ABSourcePropertyId.Init();

            // From iOS 6.0+ this might return NULL, e.g. if the application is not authorized to access the
            // address book, and we would crash if we tried to release a null pointer
            if (p != IntPtr.Zero)
            {
                CFObject.CFRelease(p);
            }
        }
Пример #3
0
 public static ABPropertyType GetPropertyType(ABPersonProperty property)
 {
     return(ABPersonGetTypeOfProperty(ABPersonPropertyId.ToId(property)));
 }
Пример #4
0
 public static string LocalizedPropertyName(ABPersonProperty property)
 {
     return(Runtime.GetNSObject(ABPersonCopyLocalizedPropertyName(ABPersonPropertyId.ToId(property))).ToString());
 }