Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to launch App Store - getting ""in something not a structure or union" error
    text
    copied!<p>I am trying to launch the App Store without launching Safari with all the redirects and I am getting an error about "Request for member 'iTunesURL' in something not a structure or union."</p> <p>I am new to a lot of this so thank you for being patient with me. I think it has something to do with me calling "self.iTunesURL" since it doesn't think iTunesURL is a part of the current class, but I could be very wrong.</p> <p>Thank you in advance for your help while I am (slowly) learning all of this.</p> <p>SampleAppDelegate.h</p> <pre><code>-(void)launchStore:(NSURL *)iTunesURL; -(void)connectionDidFinishLoading:(NSURLConnection *)connection; </code></pre> <p>SampleAppDelegate.m</p> <pre><code>// Process a LinkShare/TradeDoubler/DGM URL to something iPhone can handle - (void)launchStore:(NSURL *)iTunesURL { NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:iTunesURL] delegate:self startImmediately:YES]; [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 *)response { self.iTunesURL = [response URL]; return request; } // No more redirects; use the last URL saved - (void)connectionDidFinishLoading:(NSURLConnection *)connection { [[UIApplication sharedApplication] openURL:self.iTunesURL]; } </code></pre> <p>MyViewController.h</p> <pre><code>#import "SampleAppDelegate.h" </code></pre> <p>and i have <code>NSURL *iTunesURL;</code> within the <code>@interface</code> curley braces.</p> <pre><code>@property (nonatomic, retain) NSURL *iTunesURL; - (IBAction) proButtonPressed: (id)sender; // press to launch App Store </code></pre> <p>MyViewController.m</p> <pre><code>#import "MyViewController.h" @implementation MyViewController @synthesize iTunesURL; - (IBAction) proButtonPressed: (id) sender { NSURL *iTunesLink = [NSURL URLWithString:@"actual http URL goes here"]; SampleAppDelegate *appDelegate = (SampleAppDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate launchStore:iTunesLink]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload