logo
down
shadow

ABNewPersonViewController using contact framework


ABNewPersonViewController using contact framework

By : Rebecca
Date : November 21 2020, 03:00 PM
I hope this helps you . I'd suggest using ContactsUI framework rather than the old AddressBookUI framework. So, don't use ABNewPersonViewController, but instead use CNContactViewController:
code :
@import ContactsUI;

@interface ViewController () <CNContactViewControllerDelegate>
@end

@implementation ViewController

- (IBAction)didTapButton:(id)sender {
    CNMutableContact *contact = [[CNMutableContact alloc] init];
    [contact setGivenName:@"John"];
    [contact setFamilyName:@"Doe"];
    ...

    CNContactViewController *controller = [CNContactViewController viewControllerForNewContact:contact];
    controller.delegate = self;

    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
    nav.view.backgroundColor = [UIColor blueColor];
    [self presentViewController:nav animated:true completion: nil];
}

- (void)contactViewController:(CNContactViewController *)viewController didCompleteWithContact:(CNContact *)contact {
    [viewController.navigationController dismissViewControllerAnimated:true completion:nil];
}

@end


Share : facebook icon twitter icon
Mimic ABNewPersonViewController UI

Mimic ABNewPersonViewController UI


By : Phil
Date : March 29 2020, 07:55 AM
hope this fix your issue your idea about a single grouped UITableView could work. The way to get the smaller cells as well as the photo cell would be to subclass UITableViewCell and create it like that. and yes the photo canvus is just a custom UIView added on top of the UITableView. I'm not sure i see the point of rolling your own here, but thats how i'd start. Also i think i recall seeing a tutorial on how to build this page..try googling for it.
ABNewPersonViewController deletes contact on cancel

ABNewPersonViewController deletes contact on cancel


By : stadatum
Date : March 29 2020, 07:55 AM
To fix the issue you can do This will be of use to you:
Can ABNewPersonViewController be used to edit existing records?
ABNewPersonViewController to save contact locally

ABNewPersonViewController to save contact locally


By : Henry Branden Woodro
Date : March 29 2020, 07:55 AM
will be helpful for those in need I have looked all over SO and elsewhere and I suppose what I am trying to do is not possible. I am wondering if its possible to use ABNewPersonViewController to create a person and save it locally (i.e. not in the address book but as a file). Or if anyone knows of an open source library to accomplish that.
code :
- (void)newPersonViewController:(ABNewPersonViewController *)newPersonView didCompleteWithNewPerson:(ABRecordRef)person;
{
    if (person) {
        ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, nil);
        BOOL result = ABAddressBookRemoveRecord (addressBookRef,person,NULL);
        if (result) {
            BOOL save = ABAddressBookSave(addressBookRef, NULL);
            if (save) {
                NSLog(@"remove successfully");
            }
        }
    }
    [self.navigationController popViewControllerAnimated:YES];
}
How do you add a contact to a group programmatically in ios 9 using the Contact framework

How do you add a contact to a group programmatically in ios 9 using the Contact framework


By : joseph embedded
Date : March 29 2020, 07:55 AM
it should still fix some issue I found the class which helps me put this together : CNSaveRequest Class
Custom labels associated with a contact IOS OS X Contact Framework Swift

Custom labels associated with a contact IOS OS X Contact Framework Swift


By : Onkar Sarmalkar
Date : March 29 2020, 07:55 AM
this one helps. Here is what I managed to do in order to assign a relation to a contact and be able to fetch it using the relation
code :
var myNewContact = CNMutableContact()
let myRelation = CNContactRelation(name: "mommy")
let myMom = CNLabeledValue(label: CNLabelContactRelationMother, value: myRelation)
 myNewContact.contactRelations.append(myMom)

// add additional info to your contact such as name, email, family
// save your contact

let keysToFetch = [CNContactGivenNameKey, CNContactRelationsKey, CNContactEmailAddressesKey]    
let text =  "mommy"
    let request = CNContactFetchRequest(keysToFetch: keysToFetch)
        do {
            try store.enumerateContactsWithFetchRequest(request) {
                contact, stop in
                for var i = 0; i < contact.contactRelations.count; i++ {
                    if (contact.contactRelations[i].valueForKey("value")?.valueForKey("name")!)! as? String == text
                    {
                    print(contact.givenName)
                    print(contact.identifier)
                   }
                }
            }
        } catch let err{
            print(err)
        }
    }
Related Posts Related Posts :
  • Artefact in shader for iOS
  • Make async request in table view delegate method
  • (iOS) Escaping single quote in XML
  • Change the UIButton Image when tapped multiple times
  • Convert string JSON response to a boolean using Swift 4 Decodable
  • [iOS]renew push certificate but don't have certificateSigningRequest file
  • How to change src value in UIWebView?
  • Inserting into Array and comparing Dates Swift iOS Code
  • IBDesignable UI is not showing in Xcode 9 with Swift
  • Ask for only Request Always Authorization, and not When-In-Use Authorization
  • "Google/Analytics.h file not found" after updating pod to GoogleAnalytics
  • Post request with HTTP header parameters
  • Managing cookies for a domain in Associated Domains
  • Array items showing error in IOS
  • Saving asynchronously downloaded files' contents to SQLITE
  • Swift 4 - animating both alpha and constraint affects other components alpha value
  • UIView animation in completion block starts with displacement
  • List all Apps and Track Internet Usage
  • Handling Back To Back HTTP Posts SWIFT 4.0
  • Azure App Service Push - registration endpoint
  • Select multiple item in a tableView
  • Apartment number / Unit number returned from google places api
  • How to align UICollectionViewCells from left to right?
  • How can I add search option on UIPickerview in ios?
  • Scenekit - physicsWorld setup to prevent kinematic nodes to intersect
  • Carthage Build Failed
  • swift 3, ios 10 - push notification firebase is not received
  • App Xcode 8 to Xcode 9 - Prevent Auto Hide Status Bar
  • How to pop back to a TableViewController?
  • Is UserDefaults thread safe in Swift? How to check it?
  • UISwitch in a table selects multiple cells when switch state on
  • iOS App with no story board (Size classes and Device type limitations)
  • AudioKit issue, mic not sensitive enough
  • send indexpath to Firebase (like button)
  • UIColor saturation brightness values different from the regular saturation luminosity values of a color
  • JSON: Extracting Data Using Alamofire and Swift 3
  • invalid_grant on OAuth2 request when obtaining access_token from SSO in App
  • Design iOS button scalable
  • Subclassing NSLayoutConstraint constant based on screen height
  • Migrate Realm 2.x List of Object to Realm 3.x List of String (or other primary type)
  • Using BLE RSSI value for connect-by-proximity
  • Backgroundcolor of NSTextfield
  • Firebase modifying uid in every view
  • How to rotate orientation?
  • Upload a new version of ios app to app store?
  • UIScrollView do not scroll down to its original position when keyboard disappear
  • What is the most effective way of tracking time/dates in an iOS/Swift application?
  • WatchKit get user's preferred handedness
  • Location permission dialog is shown and immediately disappears
  • Combine these regex expressions
  • How to save an array of HKQuantitySamples (heart rate) to a workout
  • RestKit mapping with parent key as attribute and key contains parenthesis
  • How to add UITextField programmatically to UIScrollView without breaking constraints?
  • How to make a view height grow depending on its child views contents
  • Some users experiencing NSInternalInconsistencyException crash
  • Mark successful siesta response as error
  • Using a modified PDFTron Tools Framework
  • How can I use universal links when I call openURL inside my own app?
  • NSArray of doubles iOS (Objective c)
  • Passing data from embedded PageViewController to parent View Controller
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org