My app is registered to handle a private URL scheme, with which it receives 
messages from web browser bookmarklets.  If I type either this:

javascript:document.location.href='myScheme://myHost';

or this

myScheme://myHost

into Safari's address bar and hit 'return', my app gets the message.

I want to be able to send the same message from Cocoa code running in another 
app.  I realize that other methods of interapplication communication are 
available, but since the receiving end is already done in this case, I can 
minimize code and test cases by using this same private URL.

I tried The Obvious:

NSURL* url = [NSURL URLWithString:@"myScheme://myHost"] ;
NSLog(@"443: url = %@", url) ;
NSURLRequest* req = [NSURLRequest requestWithURL:url
                                     
cachePolicy:NSURLRequestReloadIgnoringCacheData
                                 timeoutInterval:15.0] ;

NSError* error = nil ;
[NSURLConnection sendSynchronousRequest:req
                      returningResponse:NULL
                                  error:&error] ;
NSLog(@"1950: error = %@", error) ;

Result:

443: url = myScheme://myHost
1950: error = Error Domain=NSURLErrorDomain Code=-1002 UserInfo=0x1001289d0 
"unsupported URL"
Underlying Error=(Error Domain=kCFErrorDomainCFNetwork Code=-1002 
UserInfo=0x100128800 "unsupported URL")

Same result if I replace myHost with myHost.me.com.

Is there a way to do this?

Thanks,

Jerry Krinock

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to