On 1 May 2013, at 10:29 PM, Zhuang Xu <stron...@gmail.com> wrote: > I am using NSWorkspace launchApplicationAtURL:options:configuration:error > launch the same app in Sandbox, sometimes there is an error: > > "The operation couldn't be completed. (OSStatus error - 10810)" > > this error appears occasionally not all the time. Is anybody know what's > going on? Am I missing something?
You don't say whether the method actually fails. The code sample you attach does not capture the result of the launchApplication… method. I am guessing that you don't use the result, but are relying on the NSError object returned by reference. This is a mistake. By convention (I hear one or two Cocoa methods are exceptions), methods that take NSError-reference arguments are free to set an error object even if no error occurred. Many methods nil-out the referenced error pointer, but they don't have to. The returned error object is valid only if the principal return value of the method indicates failure (usually nil). Capture the return value, check for nil, and only then examine the error object. > and in Mac OS 10.7.4 and 10.7.5 when I set a dictionary to the third > parameter: > > [image: Inline image 1] > > but in new app's main function, argv array don't have > "checkAccountArgument" parameter. > > in Mac OS 10.8.5 it seems OK. I'm sure this isn't your problem, but does the URL in the first argument in the method point to an .app bundle? I would not expect the method to work reliably with a bare UNIX tool. — F -- Fritz Anderson Xcode 4 Unleashed: 4.5 supplement for free! http://www.informit.com/store/xcode-4-unleashed-9780672333279 _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com