0

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.

Community
  • 1
  • 1
Idan Magled
  • 2,186
  • 1
  • 23
  • 33

1 Answers1

2

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]);
}
l0gg3r
  • 8,864
  • 3
  • 26
  • 46
  • First of all - thanks for the answer, but I'm still cant understand - you said that "gaia" framework is not supported but your snippet using it. By the way - i Cant understand what i need to do with the headers files i downloded Can you give any example that works today? Thanks. Idan. – Idan Magled Nov 28 '14 at 18:20
  • that will work on iOS 6, but seems there is no solution for ios7+ – l0gg3r Nov 28 '14 at 18:22
  • Ok, can you give me a snippet for something that will work on ios 7\8 for me to learn from it? By the way - what am i suppose to do with the headers files i'v downloaded? i need to copy tham to the private framwork folder? or just look inside them? Thanks again for the help. – Idan Magled Nov 28 '14 at 18:24
  • 1
    I'm looking and copying methods usually. I will send you example tomorrow – l0gg3r Nov 28 '14 at 18:30
  • Thanks a lot, looking forward to it. – Idan Magled Nov 28 '14 at 18:31