需要 CoreTelephony 框架示例
大家好。
谁能提供一个 CoreTelephony 框架的工作示例吗?我使用 class-dump 转储了所有 CoreTelephony 标头,并将它们添加到“/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/System/Library/PrivateFrameworks/CoreTelephony.framework”。现在我正在关注 Erica 的教程 (http://blogs.oreilly .com/iphone/2008/08/iphone-notifications.html)。
我在 main.m 中添加了以下代码行,
id ct = CTTelephonyCenterGetDefault();
CTTelephonyCenterAddObserver(
ct,
NULL,
callback,
NULL,
NULL,
CFNotificationSuspensionBehaviorHold);
但收到类似警告,
函数“CTTelephonyCenterGetDefault()”和“CTTelephonyCenterAddObserver(...)”的隐式声明。
有一个完整的工作示例,它将解释如何获取 CoreTelepony 通知?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我确实设法让这个框架部分工作 - 我仍然有一些功能,我不知道它们确切的 API - 是否有该框架中所有功能的完整描述?
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?
警告“函数的隐式声明”意味着编译器无法在标头中找到该函数的定义。
如果函数是在标头中定义的,那么您很可能没有正确导入它们。
我还要指出的是,您不应该在 iPhone 应用程序的 main.m 中放置任何代码。大多数重要代码在 UIApplication 启动之前不会加载。将代码放入应用程序委托的
applicationDidFinishLaunching:
中。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.甚至使用 http://www.alexwhittemore.com/?p=281 - 打开工具3.0 sdk 链(我找到的最后一个工具链) - 我无法让 CoreTelephony 工作 - 所以在最后一个 Xcode/SDK 中这是不可能的
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
您可以在此处找到 coretelephonyframework 示例!
You can find the coretelephonyframework example here!
我已经成功地使用了这个私有框架。这些警告不会阻止您的代码运行,但您可以在代码中添加以下声明来消除
CTTelephoneCenterGetDefault()
上的警告:(您可以执行以下操作如果您愿意,与
CTTelephonyCenterAddObserver()
警告类似)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()
:(you can do something similar for the
CTTelephonyCenterAddObserver()
warning, if you like)