Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 11-10-2009, 08:49 PM   #19 (permalink)
PeddlePower
Registered Member
 
Join Date: Apr 2009
Location: San Francisco
Posts: 15
PeddlePower is on a distinguished road
Default

Quote:
Originally Posted by kiancheong View Post
oops... sorry, havent' checked this thread lately...

here's my implementation:

Code:
// Process a LinkShare/TradeDoubler/DGM URL to something iPhone can handle
- (void)openReferralURL:(NSURL *)referralURL {
    NSURLRequest *theRequest=[NSURLRequest requestWithURL:referralURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0];
    NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
    [conn release];
}

// Save the most recent URL in case multiple redirects occur
// "iTunesURL" is an NSURL property in your class declaration
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse {
    self.iTunesURL = [redirectResponse URL];
    return request;
}

// No more redirects; use the last URL saved
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    [[UIApplication sharedApplication] openURL:self.iTunesURL];
}
however, one thing i noted here is that the app would crash if the redirect fails... comments appreciated... thanks...
Hmmm... noticed the same thing too. Seems like if the website takes too long to respond, the app gets shutdown (as being non-responsive)?

(Kinda hard to expect a website to be as quick as an app, IMHO.)

---

Correction: my crash was unrelated. Seems to be running correctly now.

Last edited by PeddlePower; 11-11-2009 at 10:52 AM.
PeddlePower is offline   Reply With Quote
 

» Advertisements
» Online Users: 546
19 members and 527 guests
.Snipe, cclark, cdbeshore, chrisfromnz, Domele, gordo26, iGamesDev, jon01, minglei, ndhieuvn212, nguyenhieu129, Rudy, st02197, SuperDietGenius, Techgirl-52, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,319
Threads: 93,988
Posts: 402,409
Top Poster: BrianSlick (7,978)
Welcome to our newest member, st02197
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:42 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.