0

Mac OS 10.8.3. This simple app runs from a custom protocol when clicking a link in the browser, for example run .

Compiled the .app with xCode, unsigned.

Works on most machines but not on some. One that doesn't work is Mac OS 10.8.2 with the gatekeeper OFF. It gives the error "failed for weird reason (13)". I guess this has got to do with permission or security. I tried chmoding Contents/MacOS/Binary to 777, but still the same.

Do I have to sign it will Apple dev certificate to make it work, or do something else in the code or plist to make it work on all machines?

plist

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>protocoltest</string>
            </array>
            <key>CFBundleURLName</key>
            <string>com.TestWebLauncher</string>
        </dict>
    </array>

AppDelegate.m

#import "AppDelegate.h"

@implementation AppDelegate

@synthesize window = _window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    if ([invokeUrl length] == 0)
    {
        invokeUrl = @"no url";
    }

    [txt setStringValue:invokeUrl];


}

- (id)init
{
    [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
    return [super init];
}

- (BOOL)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
    NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
    NSLog(@"%@", url);
    invokeUrl = url;
    return YES;
}


@end
Ska
  • 6,658
  • 14
  • 53
  • 74
  • Your app's code doesn't matter. It's not getting as far as running any of your code. The permission error is not necessarily with your app's executable, it can be any of the containing directories either in your bundle or leading to it. It can be with any libraries or frameworks that your app links against. Also, are you sure there's only the one copy of your app on the problem systems? – Ken Thomases Mar 30 '13 at 17:02
  • There might be other apps somewhere, but not in the Applications folder. I'm testing this remotely with the user, so I can't check, does it matter if he has a copy on his desktop also? How come iTunes, Spotify and other apps always work. Would it matter if the protocol was registered with IANA? – Ska Mar 30 '13 at 17:31
  • The question is which copy of the app is getting launched. If there are copies that aren't fully accessible by the user, the system may pick one of those and encounter permissions problems when attempting to launch it. And, no, it wouldn't help to register the protocol. – Ken Thomases Mar 30 '13 at 17:35
  • I'm almost sure that's not the case. Since we eliminated registration and my code, could it be that it has to be signed with Apple dev cert? Although the user in case is having gatekeeper disabled. – Ska Mar 30 '13 at 21:54
  • No, it doesn't need to be signed. Has the app been run once? It may need to have quarantined removed (not quite the same as Gatekeeper) or Launch Services may not honor the association until the user has expressed trust by running it. (It does something similar with document type associations.) Finally, you should post the complete error message verbatim. For example, does it show a path? – Ken Thomases Mar 30 '13 at 21:58
  • App has been run. For complete stack trace I will need to wait a bit to get it, put the line was like this: com.apple.launchd.peruser.501: ([0x0-0x2ce5ce3].com.TestWebLauncher[63424]) Job failed to exec(3) for weird reason: 13 – Ska Mar 31 '13 at 00:00

0 Answers0