0

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 = [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.

4

1 回答 1

0

我刚试过你的代码 and successis equals toNOfavsand favListare equals to nil,我猜AddressBookUI.framework加载失败。

之后,我尝试使用AddressBook.frameworkAddressBookUI.framework框架添加(链接)我的项目,并执行此代码(请注意,捆绑加载部分已删除):

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

它有效。也许你可以试试。

顺便说一句,您可能知道,但直接使用私有代码(在这种情况下ABFavoritesList)绝不是一个好主意,因为此代码将来可能会更改。

于 2011-09-23T20:13:34.900 回答