开发者

Geolocation API on Max OS X Snow Leopard

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 Poss开发者_运维知识库ible 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.


Sample code: WhereIsMyMac, a Snow Leopard CoreLocation project.


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:

The operation couldn’t be completed. (kCLErrorDomain error 0.)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜