我正在使用驗證密鑰從使用Wi-Fi的服務器下載內容。如果許可證密鑰錯誤或無法使用Wi-Fi,我需要顯示UIAlert。我已經寫了顯示警報視圖的警報,但警報沒有被顯示......這是把我的腦袋裏流出的血液......任何人都可以幫忙......控制權正在通過這條線,但仍然是警報沒有被顯示。無法在我的應用程序中顯示UIAlertView
-(void)connectionDidFinishLoading:(NSURLConnection *)connection{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *documentsDirectory= [[[UIApplication sharedApplication] delegate] applicationDocumentsDirectory]; //[pathToStore objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingFormat:@"packages"];
NSString *packagePath = [NSString stringWithFormat:@"%@/%@", path,isbnTemp];
[recievedData writeToFile:[documentsDirectory stringByAppendingPathComponent:@"file.zip"] atomically:YES];
NSString *zipPath=[documentsDirectory stringByAppendingPathComponent:@"file.zip"];
[fileManager createDirectoryAtPath:documentsDirectory withIntermediateDirectories:NO attributes:nil error:nil];
ZipArchive *zipArchive = [[ZipArchive alloc]init];
if([zipArchive UnzipOpenFile:zipPath]){
if([zipArchive UnzipFileTo:packagePath overWrite:YES]){
[self loadContent];
}
else{
NSLog(@"Unable to UnArchieve the packages");
}
}
else {
NSLog(@"Failure To Open Archive");
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Your ISBN and/or Licence Key are incorrect" message:Nil delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
您是否嘗試過使用非零消息? – malinois 2011-03-16 14:47:42
是的,我已經嘗試過,但我仍然運氣不佳.... – 2011-03-16 14:49:32
日誌顯示? – malinois 2011-03-16 14:51:10