Using Objective-c hidden api (iphone)

546 views Asked by At

I'm trying to use this guthub According to this link for using objective c private api but the documentation is pretty lousily.

I copied past the exemple code to my xcode but I'm getting compilation error.

NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/TelephonyUI.framework"];
BOOL success = [b load];

Class SKTelephonyController = NSClassFromString(@"SKTelephonyController");

//this line cussing the error
**id tc = [SKTelephonyController sharedInstance];**

NSLog(@"-- myPhoneNumber: %@", [tc myPhoneNumber]);
NSLog(@"-- imei: %@", [tc imei]);

error:

No known instance method for selector 'myPhoneNumber'

Can someone please have a guide or something to get started.

Oh, I know my app will not pass apple validation, I dont need there validation its an internal app.

thanks.

1

There are 1 answers

5
l0gg3r On BEST ANSWER

First of all, the example doesn't say to load SKTelephonyController, it says to load GAIA.framework
Second is that SKTelephonyController and GAIA are not available for iOS7 (they was working on iOS 6)

Here is example, how you need to dummy declare an interface, and make calls.

@interface SKTelephonyController : NSObject

+ (id)sharedInstance;
+ (NSString *)myPhoneNumber;
+ (NSString *)imei;

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/GAIA.framework"];
    BOOL success = [b load];
    if (!success) {
       NSLog(@"Can't load bundle");
       return;
    }
    NSLog(@"-- imei: %@", [[SKTelephonyController sharedInstance] imei]);
}