Max OS X Snow Leopard 上的地理定位 API
有人在 Mac OS X 10.6 中编写过使用新位置 API 的应用程序吗? 有一个示例程序在 iPhone OS 上使用相同的 API,但在 Mac OS X 上该 API 略有不同,并且 Apple 没有提供使用它的示例程序。
编辑: 我知道如何使用它,API文档也可以。对于简单的使用来说似乎过于复杂,但理解起来并不困难。另一方面,我不是 XCode 专家,所以我想知道是否有人使用它编写过任何程序,并且可能有可以使用的工作示例代码。
我阅读了 API 并了解它是如何工作的,实际上使用可以轻松地从 FPK 中使用它,这就是问题所在。我正在为在 FreePascal 中实现访问它的人寻找任何示例代码(即通过使用 ObjectivePascal 应该是可能的,但这不是我的专业领域)。我还考虑过在普通的 X-Code/ObjC 中编写一个包装器,这将生成一个普通的 .SO 文件,我可以链接到该文件以在 FreePascal 中获取我想要的内容。
我还注意到有一个定位运行,所以也许有一个更正常的类 Unix API 可以用来代替 Cocoa 方法。
Has anyone written an application that uses the new location API in Mac OS X 10.6?
There is a sample program that uses the same API for the iPhone OS, but the API is slightly different for Mac OS X, and Apple provides no sample program using it.
Edit:
I know how to use it, the API documentation is ok. It seems overly complex for simple use, but not difficult to understand. On the other hand, I am no XCode expert, so I was wondering if anyone had made any programs using this and might have working sample code to play with.
I read the API and understand how it works, it's actually using it easily from FPK that is the issue. I am looking for any sample code for someone who has implemented access to it in FreePascal (i.e. it should be Possible by using ObjectivePascal, but that is not my area of expertise). I also considered just writing a wrapper in normal X-Code/ObjC which would make a normal .SO file I could link to to get what I want in FreePascal.
I also noticed there is a locationd running, so maybe there is a more normal Unix-like API that can be used instead of the Cocoa method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
示例代码:
WhereIsMyMac,Snow Leopard CoreLocation 项目。
Sample code:
WhereIsMyMac, a Snow Leopard CoreLocation project.
对 API 的初步检查表明,它的工作原理(据我所知)与 iPhone 平台上的相同,只是在行为上有一些细微的差异。我注意到的一件事是 Dan Wood 提交的 OpenRadar bug,他指出您无法获得位置(如果您未通过 WiFi 连接)。此处的快速测试(在有线桌面上)响应错误:
这可能是您遇到的问题吗?
我目前无法访问开放的 WiFi 网络来进行进一步测试,但如果有机会我会更新这篇文章。
An initial examination of the API shows that it works (as far as I can tell) the same as on the iPhone platform, with some minor differences in behavior. One thing I noticed is an OpenRadar bug filed by Dan Wood who states you can't get a location if you're not connected by WiFi. A quick test here (on a wired desktop) responds with the error:
Could this be the problem you're experiencing?
I don't currently have access to an open WiFi network with which to test further, but I'll update this post if I get a chance.