I have a Cocoa app that has some iPhoto integration.
Since there is no Cocoa API for iPhoto, like there is for
AddressBook, the only way I know to do this is through AppleScript.
Any other ideas here would be appreciated....
[...]
I know it may seem like an AppleScript issue but the shoddy
performance is a ONLY when it is run underneath a Cocoa app so I am
under the impression that there is something Cocoa-related which is
causal.
No idea. AppleScript component memory allocation can be an issue for
some things (e.g. recursion depth), but I dunno if it'd be a factor
here. The ways of AppleScript are deep and mysterious, not to mention
a bit mental too.
At any rate, since you're presumably working in ObjC, I'd suggest
bypassing AppleScript altogether and see if that solves the problem
for you. e.g. Using objc-appscript:
if (result == nil)
NSLog(@"iPhoto raised error: %i (%@)\n", [cmd errorNumber], [cmd
errorString]);
else if ([result isEqual: [NSNull null]])
NSLog(@"iPhoto returned no result\n");
else
NSLog(@"iPhoto returned reference: %@\n", result);
[iphoto release];
[pool release];
return 0;
}
No speed problems here:
[Session started at 2007-10-20 22:26:34 +0100.]
2007-10-20 22:26:34.954 iphototest[24868] iPhoto returned reference:
[[IPApp photos] byID: 4294968071]
iphototest has exited with status 0.