• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: *Send* a URL request from Cocoa to app's private URL scheme
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: *Send* a URL request from Cocoa to app's private URL scheme


  • Subject: Re: *Send* a URL request from Cocoa to app's private URL scheme
  • From: Jeff Johnson <email@hidden>
  • Date: Sun, 01 May 2011 20:46:27 -0500

Hi Jerry.

Have you tried -[NSWorkspace openURL:]? Or do you need to send responses to the messages?

-Jeff


On May 1, 2011, at 8:21 PM, Jerry Krinock wrote:

> 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@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: *Send* a URL request from Cocoa to app's private URL scheme
      • From: Jerry Krinock <email@hidden>
References: 
 >*Send* a URL request from Cocoa to app's private URL scheme (From: Jerry Krinock <email@hidden>)

  • Prev by Date: *Send* a URL request from Cocoa to app's private URL scheme
  • Next by Date: Re: *Send* a URL request from Cocoa to app's private URL scheme
  • Previous by thread: *Send* a URL request from Cocoa to app's private URL scheme
  • Next by thread: Re: *Send* a URL request from Cocoa to app's private URL scheme
  • Index(es):
    • Date
    • Thread