gpt4 book ai didi

ios - Whatsapp URL 方案中的 ABID

转载 作者:可可西里 更新时间:2023-11-01 05:02:23 25 4
gpt4 key购买 nike

昨天 Whatsapp 更新了他们的 iOS 应用程序并发布了官方 URL 方案(api hooks)。

我想尝试一下它,但我现在面临的问题是我不理解整个“abid”的东西?!我从哪里获得联系人 ID?那我该如何使用它呢?

提前致谢:)

最佳答案

ABID代表Address book Record ID,下面的代码用于获取AB Record ID。它对 URL 本身中分隔符的使用很敏感。所以最初的试验没有奏效。要向特定用户发送注释,请使用此 - urlstring 格式: whatsapp://send?abid=123&text=What%20a%20nice%20day - 注意使用 & 标记第二个参数。

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController    *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
QR_whatsappABID = (ABRecordID)ABRecordGetRecordID(person);
....
QR_whatsapp_string = [NSString stringWithFormat:@"whatsapp://send?abid=%d&text=%@;",QR_whatsappABID, outmessage];
....
}

这可以在不使用人员选择器的情况下进行编码,只需打开地址簿即可:

比较姓名或姓名和号码,一项一项地查看记录 -

ABAddressBookRef addressBook = ABAddressBookCreateWithOptions (NULL, error);
int len = (int)ABAddressBookGetPersonCount(addressBook);
for(int i = 1; i < (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]] && [[last lowercaseString] isEqualToString:[surname lowercaseString]]) {
alreadyExists = YES;
ABID = ABRecordGetRecordID(person);
break;
}
}

关于ios - Whatsapp URL 方案中的 ABID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17711325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com