0

so what I'm trying to do here is the following: let's say the user has already installed my app, app "A", from the store. On certain conditions, app "A" will open an URL pointing to a specific app page,app "B", on the App Store passing a redemption code so the user of app A is able to download app "B" without paying any additional money. So here's what I'm doing:

NSString *urlBase = @"https://phobos.apple.com/WebObjects/MZFinance.woa/wa/freeProductCodeWizard?code=";

NSURL *urlRedemptionCode = [NSURL URLWithString:[urlBase stringByAppendingString:code]];

[[UIApplication sharedApplication] openURL:urlRedemptionCode];

This is working fine, so the question is: how do I know that the download of app "B" was completed correctly (or with errors) so I can take appropriate action in app "A"?

Thanks so much.

CCSwift
  • 37
  • 5

1 Answers1

0

You could use NSURLConnection in combination with NSURLRequest and NSURLResponse instead of directly calling [[UIApplication sharedApplication] openURL:yourURL].

NSURLConnection will allow you to set a delegate that will be notified when:

  • Data is (partially) received
  • Connection failed
  • Download finished
  • etc.

Check Using NSURLConnection at the official documentation.

msoler
  • 2,930
  • 2
  • 18
  • 30