iPhone 地址簿外部回拨通知?
在viewDidLoad中,我订阅了通知以获取外部回调通知。 如果我更改了 iphone 联系人中的任何内容,我不知道为什么我没有在应用程序中收到通知。
我正在这样做:
ab=ABAddressBookCreate();
ABAddressBookRegisterExternalChangeCallback(ab, MyAddressBookExternalChangeCallback, self);
并且我已经在同一个控制器中定义了它,
void MyAddressBookExternalChangeCallback ( ABAddressBookRef addressBook, CFDictionaryRef info, void *context ) {
[((TGTextsInboxController *) context) addressBookHasChanged];
}
我如何调试它?我在模拟器中尝试过这种方式。
- 我打开我的应用程序到 TGTextsInboxController viewController
- 我按下主页按钮,我的应用程序进入后台
- 现在我已经打开 iPhone 联系人,更改了任何人的任何电话号码。
- 再次从后台打开应用程序到前台。
- 没有反映任何通知。调试器指针都没有命中此方法“MyAddressBookExternalChangeCallback”
有问题吗?
In viewDidLoad, I have subscribed to notifications to get external callback notifications.
I dont know why I am not getting notifications in my app if i have changed anything in my iphone contacts.
I am doing in this way:
ab=ABAddressBookCreate();
ABAddressBookRegisterExternalChangeCallback(ab, MyAddressBookExternalChangeCallback, self);
And I have defined this in same controller
void MyAddressBookExternalChangeCallback ( ABAddressBookRef addressBook, CFDictionaryRef info, void *context ) {
[((TGTextsInboxController *) context) addressBookHasChanged];
}
How can I debug this ? I have tried in this way in Simulator.
- I opened my app upto TGTextsInboxController viewController
- I pressed home button, my app went in background
- nNow i have opened iPhone Contacts, changed any phone number of any person.
- Open app again from background to foreground.
- No notifications has been reflected. Neither degugger pointer hit to this method "MyAddressBookExternalChangeCallback"
Something wrong ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题已解决:
我在收到通知后发布了
CFRelease(ab);
。我一评论那行。我能够收到通知。Problem resolved:
I was releasing
CFRelease(ab);
after notification. As soon as i have commented that line. I am able to get notifications.使用地址簿回调。
我的样本 - 注册(创建 addressBookRef 后)
我的 Smaple - 做一些事情和做一些事情取消注册
我的回答:
iPhone通讯录
Use addressBook call back.
My Sample - Register (After creating addressBookRef)
My Smaple - Do Something & Unregister
My answer:
Iphone addressbook