我正在使用验证密钥从使用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