views:

675

answers:

4

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?

A: 

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.

TechZen
I know the why I'm getting the warning. But the problem is where can I find the definition for 'CTTelephonyCenterGetDefault()'?I used the import statement #import<CoreTelephony/CoreTelephony.h> and the other required import statements properly. But not able to proceed further.Do you have any Idea or any working code? If you have can you please share with me?I'll try to move my code to "applicationDidFinishLaunching".
prathumca
The comments to the Erica Sadun blogpost say that you cannot do this within Xcode but have to use something call the "Open SDK" (http://blogs.oreilly.com/digitalmedia/2008/03/iphone-open-sdk-vs-closed-sdk.html) One of the commenters report the same error you are getting. That blogpost is also two years old so I don't know how relevant it is today. You're working on something that is very, very non-standard. It might not have a simple answer or be possible anymore.
TechZen
A: 

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

freennnn
A: 

Hello can we add or show the view in core telephony framework. if possible then how? Actually i have two diffrent application, one for inbound, second for outbound, i need to show one view after 5sec-10sec of call whether its incoming or outgoing.Please help me out and revert me back as soon as possible . and its also a request please also send the reply to my gmail address [email protected]. Really i need the code.

Sahil Goenka
+1  A: 

prathumca, are you still having this issue? 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();

Tony
I did it succesfully a while ago. Yes you're right, we need to put the "extern id CTTelephonyCenterGetDefault();" at the strting of your .mm file.
prathumca