SBApplication taking forever to instantiate

  • I have the following code:

    NSLog(@"Connecting to iPhoto app object");
    iPhotoApplication *iPhoto = [[SBApplication alloc]
    initWithBundleIdentifier:@"com.apple.iPhoto"];
    [iPhoto autorelease];
    NSLog(@"Connected to iPhoto app object");

    This works fine if I use the identifier "com.apple.Finder". However, if
    I try to use iPhoto then it takes 15-30 seconds to instantiate, even on
    a fresh install/empty library for iPhoto.  I've tried with the program
    running and not as well, and the object still won't return in any
    acceptable amount of time. (If iPhoto is stopped, trying to instantiate
    this object will start it, and then still take forever to finish.)

    2008-01-03 14:30:14.818 MyApp[8284:10b] Connecting to iPhoto app object
    2008-01-03 14:30:39.553 MyApp[8284:10b] Connected to iPhoto app object

    Any ideas on why it's going so slowly, or a better place to ask if this
    isn't it?  (Scripting Bridge is a strange one, part Cocoa and part AS,
    so I have no idea where to ask.)

    -- Adam
  • Have you tried Sharking it? Sometimes the stack crawls can give
    interesting clues (even if it's not in code you control directly).

    Adam Knight wrote:
    > I have the following code:
    >
    > NSLog(@"Connecting to iPhoto app object");
    > iPhotoApplication *iPhoto = [[SBApplication alloc]
    > initWithBundleIdentifier:@"com.apple.iPhoto"];
    > [iPhoto autorelease];
    > NSLog(@"Connected to iPhoto app object");
    >
    > This works fine if I use the identifier "com.apple.Finder". However, if
    > I try to use iPhoto then it takes 15-30 seconds to instantiate, even on
    > a fresh install/empty library for iPhoto.  I've tried with the program
    > running and not as well, and the object still won't return in any
    > acceptable amount of time. (If iPhoto is stopped, trying to instantiate
    > this object will start it, and then still take forever to finish.)
    >
    > 2008-01-03 14:30:14.818 MyApp[8284:10b] Connecting to iPhoto app object
    > 2008-01-03 14:30:39.553 MyApp[8284:10b] Connected to iPhoto app object
    >
    > Any ideas on why it's going so slowly, or a better place to ask if this
    > isn't it?  (Scripting Bridge is a strange one, part Cocoa and part AS,
    > so I have no idea where to ask.)
    >
    > -- Adam
    >
  • Adam Knight wrote:

    > I have the following code:
    >
    > NSLog(@"Connecting to iPhoto app object");
    > iPhotoApplication *iPhoto = [[SBApplication alloc]
    > initWithBundleIdentifier:@"com.apple.iPhoto"];
    > [iPhoto autorelease];
    > NSLog(@"Connected to iPhoto app object");
    >
    > This works fine if I use the identifier "com.apple.Finder". However,
    > if
    > I try to use iPhoto then it takes 15-30 seconds to instantiate, even
    > on
    > a fresh install/empty library for iPhoto.  I've tried with the program
    > running and not as well, and the object still won't return in any
    > acceptable amount of time.

    No idea. I see no significant delay here: 1-3 sec including iPhoto
    launch time (this will vary, of course); 0.15 sec if already running.
    FWIW, last time someone ran into response delays with iPhoto, it
    turned out to be a contention issue:

    http://lists.apple.com/archives/Cocoa-dev/2007/Oct/thrd11.html#00983

    Oh, and obligatory objc-appscript-is-better-than-Scripting-Bridge-
    anyway link:

    http://appscript.sourceforge.net/objc-appscript.html

    has
    --
    http://appscript.sourceforge.net
    http://rb-appscript.rubyforge.org
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today