Script Bridge 和 iPhoto - 纬度/经度信息仅是 NSInteger?
我正在尝试使用 Obj-C 中的 Script Bridge(XCode 4.1,SDK 10.7)访问 iPhoto 图像中的 GPS 信息。下面是一个代码片段:
iPhotoApplication *iPhoto = [SBApplication applicationWithBundleIdentifier:@"com.apple.iPhoto"];
NSArray *selection = [iPhoto selection];
for ( iPhotoPhoto *i in selection ) {
NSLog(@"'%@': lat %ld, lon %ld", [i imageFilename], [i latitude], [i longitude]);
}
不幸的是,纬度和经度属性是 NSInteger 类型,它产生的结果非常不精确(例如 38,120),以至于完全无用。使用Applescript 访问相同的属性时会产生正确的值(例如,38.03555555、-120.401388883333)。有没有更好的方法在 Obj-C 中获取此信息?
另外,iPhotoPhoto 类有一个名为“id”的属性,由于 id 是 Obj-C 保留字,所以无法获取该属性。 [i id] 编译但崩溃。再说一遍,我如何获得这个属性?
我尝试为 XCode 4/SDK 10.7 构建 appscript 但没有成功。
I am trying to access the GPS info in iPhoto images using Script Bridge in Obj-C (XCode 4.1, SDK 10.7). Here is a code snippet:
iPhotoApplication *iPhoto = [SBApplication applicationWithBundleIdentifier:@"com.apple.iPhoto"];
NSArray *selection = [iPhoto selection];
for ( iPhotoPhoto *i in selection ) {
NSLog(@"'%@': lat %ld, lon %ld", [i imageFilename], [i latitude], [i longitude]);
}
Unfortunately, the latitude and longitude properties are type NSInteger, which yields results so imprecise (eg, 38,120) as to be totally useless. The same properties when accessed with Applescript yield correct values (eg, 38.03555555,-120.401388883333). Is there a better way to get this info in Obj-C?
Also, the iPhotoPhoto class has a property called "id", which is impossible to get since id is an Obj-C reserved word. [i id] compiles but crashes. Again, how do I get this property?
I have tried to build appscript for XCode 4/SDK 10.7 but without success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以通过获取其属性来实现
This is possible by getting its properties