开发者

iOS Contacts Favorites

I am trying to access the favorite contacts via the private frameworks. I followed the siphon code and got the frameworks from iOS-Runtime-Headers

The code that I wrote to access the list is:

    NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/Frameworks/AddressBookUI.framework"];
  BOOL success = 开发者_JS百科[b load];

  Class favs = NSClassFromString(@"ABFavoritesList");

  id favList = [favs sharedInstance];

  NSLog(@"Favs count = %d", [[favList entries] count]);

For some reason the the entries are being fetched as nil. Any help would be appreciated.


I just tried your code and success is equals to NO, and favs and favList are equals to nil, I guess the AddressBookUI.framework fail to load.

After that, I tried adding (linking) my project with the AddressBook.framework and AddressBookUI.framework frameworks, and executing this code (note that the bundle load part is removed):

Class favs = NSClassFromString(@"ABFavoritesList");
id favList = [favs sharedInstance];
NSLog(@"Favs count = %d", [[favList entries] count]);

and it works. Maybe you can try that.

By the way, you probably know it, but it is never a good idea to directly use private code (in this case ABFavoritesList), as this code may change in the future.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜