10

Yesterday I tried to use Private API within iOS 7 but it doesn't work. The following calls works fine with iOS 6:

1. NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/AppleAccount.framework"];
2. BOOL success = [b load];
3.
4. Class AADeviceInfo = NSClassFromString(@"AADeviceInfo");
6.
7. NSLog(@"-- serialNumber: %@", [AADeviceInfo serialNumber]);
8. NSLog(@"-- udid: %@", [AADeviceInfo udid]);

When using this code snippet within iOS 7 it returns a null pointer. The framework, class and methods still exists (click me). Any idea for my problem? Is there an additional layer of security that makes it no longer possible to call private API within iOS 7?

Thank you!

MrCoinSiX
  • 571
  • 1
  • 6
  • 13
  • @H2CO3: Very useful comment. Let's make SO better using stingy irony. – Victor Ronin Sep 15 '13 at 14:48
  • 2
    @H2CO3: OP don't cry in his question. He shows the code, he explains that it doesn't work and he asked about additional layer of security (actually, he has quite good question). I agree with you that usage of private api is risky endeavor, but your comments aren't helpful, because they don't give any useful information. BTW. Many antiviruses in PC era used a lot of undocumented OS functionality and they grew big successful businesses out it. So, I wouldn't private API usage so fast. – Victor Ronin Sep 15 '13 at 15:01

1 Answers1

8

In most cases, such behavior means this API became protected by an entitlement. This is a authorization method used across iOS. Most of API's call out of process server. And this server may check whether a client has some specific entitlement. Entitlements are available only for system apps and 3rd party apps on jailbroken iOS.

There is no simple way to check whether the server requires entitlement. However, sometimes it writes in the console something like "Hey... You need entitlement X to call API Y". However, most of the time, it fails silently.

If you really wants to check this, you will have to disassemble framework to see which server does it use and disassemble server and find implementation of this API.

Nate
  • 31,017
  • 13
  • 83
  • 207
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
  • i don't really understand this answer, but my AADeviceInfo cannot get uuid on iOS7 either. – z33 Dec 23 '13 at 09:56
  • @z33: Please elaborate on what you don't understand. – Victor Ronin Dec 23 '13 at 15:35
  • thanks for asking. I don't understand the answer is YES or NO. I guess the answer is NO unless we have to " have to disassemble framework to see which server does it use and disassemble server and find implementation of this API." to find the answer. am i right? – z33 Jan 06 '14 at 02:52
  • Yes. You are right. The answer is "Most likely NO", but to be 100% sure, a lot of disassembling required. – Victor Ronin Jan 06 '14 at 16:57