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.