iphone - Unable to show UIAlertView -


I am using the verification key to download content from a server using Wi-Fi in my app. I need to show UILLert if the keys of the license are wrong or if Wi-Fi is not available I have written the coed to display the warning scene but the warning is not being displayed ... it blew outside my head Is ... Can someone help .... The control is going on this line, but still the warning is not being displayed. - (zero) connection diffilisk loading: (NSURLConnection *) connection {NSFileManager * fileManager = [NSFileManager defaultManager]; NSString * document directory = [[[UIApplication shared application] representative] Application Document Directory]; // [PathtoosterObjectAntindex: 0]; NSString * path = [document directory stringbuffing formatting: @ "package"]; NSString * packagePath = [NSString stringWithFormat: @ "% @ /% @", path, isbnTemp]; [Received data data file: [document directory stringbapping padding contract: @ "file .zip"] atomic: yes]; NSString * Zippath = [Document Directory StringBapCensing Path Companent: @ "File .zip"]; [File Manager Creating Directory Entity: Document Intermediates with Directory: No Properties: Zero Error: Zero]; ZipRaki * ZIPArchive = [[ZIPArchive Elok] Init]; If ([zipper lift openfile: zippath]) {if ([ZIPPerzive envelope: package path overwrite: yes]) {[self-load communication]; } And {NSLog (@ "unable to unblock the package"); }} And {nslog (@ "failure to open archive"); UIAlertView * Warning = [[UIAlertView alloc] initWithTitle: @ "Your ISBN and / or license key are incorrect" Message: Nil Representative: Cancel self-annotation: @ "OK" other button titles: zero]; [Alerts show]; [Warning issued]; }

}

Do you try to show UIAlertView Are there a method that is being called by a thread other than the main thread? For example, if you are trying to show UILartview in an asynchronous callback, then it can run on a separate thread.

If this is the case, then you need to move the code that shows a different selector to the UILERTview,

P>

- (zero) Show Alert {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ " Your ISBN and / or license key are incorrect "Message: Nil Representative: Cancel self-certification: @" OK "other button titles: zero]; [Alerts show]; [Warning issued]; }

and then replace the last clause in your current code so that it can be used:

  [self performSelectorOnMainThread: @selector (showAlert) withObject : Zero waitUntilDone: NO]; See for more information on   

performSelectorOnMainThread: methods.

Comments