Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do i check importing contacts from iphone
    primarykey
    data
    text
    <pre><code>- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { // setting the first name NSString *fname = (__bridge NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty); // setting the last name NSString *lname = (__bridge NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty); NSString *mail=(__bridge NSString*)ABRecordCopyValue(person, kABPersonEmailProperty); //NSString *mobile=(__bridge NSString*)ABRecordCopyValue(person, kABPersonPhoneProperty); ABMultiValueRef multi = ABRecordCopyValue(person, kABPersonPhoneProperty); NSString *pNo = (__bridge NSString*)ABMultiValueCopyValueAtIndex(multi, 0); NSLog(@"LLname%@",lname); NSLog(@"fLname%@",fname); NSLog(@"mobile%@",pNo); NSLog(@"mail%@",mail); if([fname isEqualToString:@""] || fname == nil) { UIAlertView *locationAlert = [[UIAlertView alloc] initWithTitle:nil message:@"Please enter first name." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", @"") otherButtonTitles:nil]; [locationAlert show]; // return; } else if([lname isEqualToString:@""]|| lname == nil) { UIAlertView *locationAlert = [[UIAlertView alloc] initWithTitle:nil message:@"Please enter last name." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", @"") otherButtonTitles:nil]; [locationAlert show]; //return; } else if([pNo isEqualToString:@""]|| pNo == nil) { UIAlertView *locationAlert = [[UIAlertView alloc] initWithTitle:nil message:@"Please enter mobile no." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", @"") otherButtonTitles:nil]; [locationAlert show]; // return; } else if([mail isEqualToString:@""] || mail == nil) { UIAlertView *locationAlert = [[UIAlertView alloc] initWithTitle:nil message:@"Please enter email address." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", @"") otherButtonTitles:nil]; [locationAlert show]; //return; } else { ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty); CFStringRef email = ABMultiValueCopyValueAtIndex(emails, 0); NSLog(@"email %@\n",(__bridge NSString *) email); // setting the number /* this function will set the first number it finds if you do not set a number for a contact it will probably crash */ NSString *mNo = pNo; mNo=[mNo stringByReplacingOccurrencesOfString:@"(" withString:@""]; mNo=[mNo stringByReplacingOccurrencesOfString:@")" withString:@""]; mNo=[mNo stringByReplacingOccurrencesOfString:@" " withString:@""]; mNo=[mNo stringByReplacingOccurrencesOfString:@"-" withString:@""]; // NSLog(@"mno %@\n",mNo); NSString *name = [fname stringByAppendingFormat:[NSString stringWithFormat:@" %@",lname]]; [clist setValue:mNo forKey:name]; // NSLog(@"dic %@\n",clist); // [allcontactArray addObject:name]; // [contactList addObject:(NSArray *)allcontactArray]; [contacts addObject:name]; // NSLog(@"contacts %@\n",contacts); // NSLog(@"str %@\n",[clist objectForKey:name]); [contactArr addObject:name]; [contactDic setObject:mNo forKey:name]; // NSLog(@"arr: %@\n",contactArr); // NSLog(@"dic: %@\n",contactDic); contactname = name; [contactStr appendFormat:@"%@, ",name]; // NSLog(@"contactstr: %@\n",contactStr); // NSLog(@"mno %@\n",mNo); [phoneNoArray addObject:mNo]; [phoneStr appendFormat:@"%@=",mNo]; // NSLog(@"phonearr: %@\n",phoneNoArray); // NSLog(@"phonestr: %@\n",phoneStr); tf.text = contactStr; // remove the controller [self dismissModalViewControllerAnimated:YES]; return NO; } } </code></pre> <p>I am using this open source to importing contact from iphone.My app getting crashed when firstname or lastname or mobile no or email empty.I can able to check firstname and lastname empty or not.I am not able to check mobileno and email.Please help to solve this problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload