Question

Greetings everyone.

Can any one has a working example for the CoreTelephony framework? I dumped all the CoreTelephony headers using class-dump and added them to "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/System/Library/PrivateFrameworks/CoreTelephony.framework". Now I'm following the Erica's tutorial (http://blogs.oreilly.com/iphone/2008/08/iphone-notifications.html).

I added these following lines of code in my main.m,

  id ct = CTTelephonyCenterGetDefault();
  CTTelephonyCenterAddObserver(
        ct, 
        NULL, 
        callback,
        NULL,
        NULL,
        CFNotificationSuspensionBehaviorHold);

but I'm getting a warning like,

Implicit declaration of function "CTTelephonyCenterGetDefault()" and "CTTelephonyCenterAddObserver(...)".

Can any one has full working example, which will explain how to get the CoreTelepony notifications?

Was it helpful?

Solution

I have been successfully using this private framework. The warnings will not prevent your code from running, but you could put the following declaration in your code to get rid of the warning on CTTelephoneCenterGetDefault():

id CTTelephonyCenterGetDefault();

(you can do something similar for the CTTelephonyCenterAddObserver() warning, if you like)

OTHER TIPS

I Did managed to get this framework to work partially - i still have some functions that i don't know their exact API - is there somewhere a full description of all the functions in this framework?

The warning "Implicit declaration of function" means that the compiler cannot find a definition for the function in the header.

If the functions are defined in the header then you most likely did not import them correctly.

I would also note that you should not put any code in the main.m of an iPhone app. Most of the important code does not load until UIApplication is launched. Put the code in the application delegate's applicationDidFinishLaunching: instead.

even using http://www.alexwhittemore.com/?p=281 - Open Tool Chain for 3.0 sdk (last tool chain i'd found) - i couldn't have CoreTelephony working - so it's seams to be impossible in last Xcode's/SDK's

You can find the coretelephonyframework example here!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top