Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 19    Views: 165

Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
12/23/12 09:58 AM (13 years ago)

CustomURL Tutorial update

Hi guys and gals have updated my Tutorial for using custom URLs. Now includes code to parse the custom url. The custom URL can now open specific screens. https://dl.dropbox.com/u/16651980/CustomURLScheme.pdf Enjoy
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
12/23/12 12:09 PM (13 years ago)
Very nice! Thank you so much for writing this up. This really solves a problem.
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
12/23/12 01:59 PM (13 years ago)
That's a keeper! Thanks Kittsy.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
12/23/12 04:35 PM (13 years ago)
It's a fun way of giving users access to different screens
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
12/23/12 04:45 PM (13 years ago)
Ha! Thanks:)
 
chadh0130
Apple Fan
Profile
Posts: 352
Reg: Nov 05, 2011
Rhode Island
4,020
like
12/23/12 07:08 PM (13 years ago)
@kittsy, Thanks a lot for this tutorial. Great way to use the password splash screen and email marketing. I have one question though, say I send out a email and someone clicks on the customURL, and they don't have the app...what will happen or is there a way to send them directly to the app store link to download the app?
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
12/23/12 07:12 PM (13 years ago)
Thanks @kittsy this makes a lot more sense now!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/23/12 10:06 PM (13 years ago)
Thanks for the tutorial! Is this limited to a certain version of iOS?
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
12/24/12 07:36 AM (13 years ago)
I think it works with the method on the tutorial from Xcode 4.0
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
12/24/12 09:01 AM (13 years ago)
Wow. So is this the answer to opening BT screens from HTML docs? I had a hunch the customURL scheme was the first part of that equation. That appdelegate code is key. Now this makes sense. Nice work. Could an array work there to keep a list of screens/links to open with CustomURL's? I use this site to test them - and maybe someday add a few of my own for apps! http://handleopenurl.com Great stuff as usual Kittsy, huge puzzle piece.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
12/26/12 10:32 AM (13 years ago)
This is great. Working well to open your app from safari to a specified screen. The only glitch I see so far is that if you have a Splash Screen it will display that first. (if you use a -1 to keep the splash until a user taps, it will hang there) Testing to see if I can get it to open BT screens from an HTML or Custom URL doc. It senses the URL, but it's not closing the ios webview and launching the app to the screen. It's pulling up an action sheet. maybe iOS webview is confused with stuff other than 'http'....
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
12/26/12 11:05 AM (13 years ago)
My original plan for this is was for a trigger image in aurasma to load a hidden screen. To be fair I haven't tested it with the HTML custom URL. The splash issue is with buzztouch, the custom URL scheme is ios method so I don't know away around that
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/26/12 01:12 PM (13 years ago)
I assume a local HTML doc and a custom URL screen would behave the same?
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
12/26/12 01:59 PM (13 years ago)
I don't think we are getting around the splash, if you use one, when the app launches, it's gonna launch. But I do think there is code to deal with the UIWebview problem. A quick search on stack shows lots of users with tips/workarounds. This seems to be the start- - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
12/26/12 02:46 PM (13 years ago)
Do a search in your project for open in native something like that. You will see a load of custom urls like YouTube:// and mail:// add code to that with your app details and write a method. Not by a computer so can't have a look
 
cpmilez
Aspiring developer
Profile
Posts: 63
Reg: Jan 03, 2012
Ipswich, UK
6,030
like
01/25/13 02:21 PM (13 years ago)
This is working great thanks Kitty. I was was after a way of linking from a Custom HTML screen to another screen and this works perfect from tests done so far. Rather than using the if statement I remove this and just changed the load screen line as below so it uses the url host directly. //load new screen BT_item *mynextScreen = [appDelegate.rootApp getScreenDataByItemId:[url host]]; This way I can load any screen by just specifying the item id like yourURLScheme://itemId
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
01/25/13 02:24 PM (13 years ago)
Good stuff
 
cpmilez
Aspiring developer
Profile
Posts: 63
Reg: Jan 03, 2012
Ipswich, UK
6,030
like
01/29/13 01:50 PM (12 years ago)
Ran into a problem with iOS5, its working great on iOS6 but found on the Mrs iPhone still running iOS5 the links in my custom html pages don't work, nothing happens when I touch them. I downloaded the iOS5 simulator in Xcode and replicated and found the error as below, just need to find a way round this now, if anyone could help. 2013-01-29 20:42:35.847 elite[1171:18503] BT_screen_customHTML: shouldStartLoadWithRequest 2013-01-29 20:42:35.847 elite[1171:18503] BT_screen_customHTML: url to load: elite://test 2013-01-29 20:42:35.847 elite[1171:18503] BT_screen_customHTML: url scheme: elite 2013-01-29 20:42:35.848 elite[1171:18503] BT_screen_customHTML: didFailLoadWithError: iOS Error Code: 101 iOS Error Message: The URL can’t be shown 2013-01-29 20:42:35.848 elite[1171:18503] BT_screen_customHTML: hideProgress
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
01/29/13 02:20 PM (12 years ago)
I seem to remember that this was a new feature of iOS 6.
 
cpmilez
Aspiring developer
Profile
Posts: 63
Reg: Jan 03, 2012
Ipswich, UK
6,030
like
01/29/13 02:31 PM (12 years ago)
Got it to work with a change to BT_screen_customHTML.m Added the following below to: shouldStartLoadWithRequest just before the last "return yes" // Determine if we want the system to handle it. NSURL *url = request.URL; if (![url.scheme isEqual:@"http"] && ![url.scheme isEqual:@"https"] && ![url.scheme isEqual:@"file"]) { if ([[UIApplication sharedApplication]canOpenURL:url]) { [[UIApplication sharedApplication]openURL:url]; return NO; } }
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.