vir*_*ata 8 cocoa-touch objective-c iphone-privateapi ios
我需要实现一个应用程序来监控iPhone上不同应用程序的入站/出站连接.我的应用程序将在后台使用苹果的背景多任务功能为voip和导航器运行.我可以使用私有api,因为我的客户端在appstore上不需要这个应用程序.
谢谢.
我熬过来了。
我不需要任何私有 Api 来获取入站/出站活动连接的信息。您只需要了解基本的 C 编程知识和一些耐心即可。
我就此问题写信给苹果开发论坛,得到的答复是-
From my perspective most of what I have to say about this issue is covered in the post referenced below.
<https://devforums.apple.com/message/748272#748272>>
The way to make progress on this is to:
o grab the relevant headers from the Mac OS X SDK
o look at the Darwin source for netstat to see how the pieces fit together
WARNING: There are serious compatibility risks associated with shipping an app that uses this technique; it's fine to use this for debugging and so on, but I recommend against shipping code like this to end users.
Run Code Online (Sandbox Code Playgroud)
我一步一步所做的是 -
1)从BSD开源下载netstat的代码-
2)将其添加到您的新 iphone 项目中。
3)看,ios sdk 中不存在某些头文件,因此您需要从 opensource.apple.com 复制它,并将其添加到您的 iphone sdk 中的相关路径下 -
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include
Run Code Online (Sandbox Code Playgroud)
我的xcode版本是4.5.2。所以这是与我的 xcode 相关的路径。你可以根据xcodes的版本有不同的路径。无论如何。并记住在 iosSdk 和 iOSSimulatorSdk 中添加这些标头,以便代码可以在设备和模拟器上运行。
4)您可能会在netstat代码中发现一些小错误,这些错误与在头文件中找不到某些结构的定义有关。例如“struct xunpcb64”。不用担心。那里有定义。您需要在这些头文件中注释一些“#if!TARGET_OS_EMBEDDED”#else,以便ios sdk可以到达这些if条件并访问定义。(需要一些尝试和错误。要有耐心。)
5)最后你就可以编译你的代码了。干杯!!
| 归档时间: |
|
| 查看次数: |
4259 次 |
| 最近记录: |