Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>ABID stands for the Address book Record ID,the code below works to get the AB Record ID. It is sensitive to the use of delimeters in the URL itself. So the initial trials were not working. To send a note to a specific user use this - urlstring format: whatsapp://send?abid=123&amp;text=What%20a%20nice%20day - note the use of &amp; to mark the second parameter.</p> <pre><code>- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { QR_whatsappABID = (ABRecordID)ABRecordGetRecordID(person); .... QR_whatsapp_string = [NSString stringWithFormat:@"whatsapp://send?abid=%d&amp;text=%@;",QR_whatsappABID, outmessage]; .... } </code></pre> <p>this can be coded without using the people picker simply open the address book:</p> <p>go through the records one by one comparing the name or name and number - </p> <pre><code>ABAddressBookRef addressBook = ABAddressBookCreateWithOptions (NULL, error); int len = (int)ABAddressBookGetPersonCount(addressBook); for(int i = 1; i &lt; (len + 1); i++) { ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, (ABRecordID)i); NSString *first, *last; if (!person) { continue; } CFStringRef firstc = (CFStringRef)ABRecordCopyValue(person, kABPersonFirstNameProperty); if (firstc) { CFStringRef lastc =(CFStringRef) ABRecordCopyValue(person, kABPersonLastNameProperty); if (lastc) { first = [NSString stringWithFormat:@"%@",firstc]; last =[NSString stringWithFormat:@"%@",lastc]; CFRelease(lastc); } CFRelease(firstc); } if ([[first lowercaseString] isEqualToString:[firstname lowercaseString]] &amp;&amp; [[last lowercaseString] isEqualToString:[surname lowercaseString]]) { alreadyExists = YES; ABID = ABRecordGetRecordID(person); break; } } </code></pre>
 

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