我需要建议如何做。
我在App Store上有几个应用程序,它们都经过测试,并且完全适用于以前的所有iOS。但是现在当我将我的设备更新到iOS5时,其中一些设备开始意外地在要求连接到互联网并显示当前位置地图的警报视图项上崩溃。
我不具备开发经验,所以需要一些建议怎么做?我认为,对于iOS5的最终版本,这些东西将自行修复或不修复。
感谢。
好的,我已经为僵尸做过工作,并找到了解决问题的方法。
- (void) alertView: (UIAlertView*) alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
NSLog(@" Button PRESSED: %d", buttonIndex);
[alertView release];
if (buttonIndex == 1) {
BOOL noConnectionAvailable = NO;
BOOL hasParentalLimit = NO;
switch (lastSelectedItem.itemType) {
case RestaurantItemTypeAddress : {
if ([NetworkHelper connectedToNetwork] == YES) {
AddressController *mapController = [[AddressController alloc] initWithNibName:@"AddressController" bundle:nil restaurant:restaurant];
mapController.title = restaurant.res_title;
[self.navigationController pushViewController:mapController animated:YES];
[mapController release];
} else
noConnectionAvailable = YES;
break;
}
case RestaurantItemTypeReservationEmail : {
if ([NetworkHelper connectedToNetwork] == YES) {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Reservation"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:lastSelectedItem.itemTextContent];
[picker setToRecipients:toRecipients];
// Fill out the email body text
NSString *emailBody = @"";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
[picker release];
[self.tableView deselectRowAtIndexPath:lastSelectedIndexPath animated:YES];
} else
noConnectionAvailable = YES;
break;
}
case RestaurantItemTypeReservationForm : {
if ([NetworkHelper connectedToNetwork] == YES) {
if ([NetworkHelper canOpenUrl:lastSelectedItem.itemTextContent]) {
WebViewController *wvc = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil urlStr:lastSelectedItem.itemTextContent];
wvc.title = restaurant.res_title;
[self.navigationController pushViewController:wvc animated:YES];
[wvc release];
} else hasParentalLimit = YES;
} else
noConnectionAvailable = YES;
break;
}
case RestaurantItemTypeWeb : {
if ([NetworkHelper connectedToNetwork] == YES) {
if ([NetworkHelper canOpenUrl:lastSelectedItem.itemTextContent]) {
WebViewController *wvc = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil urlStr:lastSelectedItem.itemText];
wvc.title = restaurant.res_title;
[self.navigationController pushViewController:wvc animated:YES];
[wvc release];
} else hasParentalLimit = YES;
} else
noConnectionAvailable = YES;
break;
}
}
if (noConnectionAvailable == YES) {
UIAlertView* newAlert = [[UIAlertView alloc] initWithTitle:@"Jesolo Official Guide"
message:@"Nessuna connessione disponibile."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[newAlert show];
}
if (hasParentalLimit == YES) {
UIAlertView* newAlert = [[UIAlertView alloc] initWithTitle:@"Jesolo Official Guide"
message:@"Navigazione su Web non consentita."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[newAlert show];
}
}
[self.tableView deselectRowAtIndexPath:lastSelectedIndexPath animated:NO];
}
iOS4和iOS5上的日志不同。 在iOS5上,它说:
2011-11-04 16:26:28.550 Jesolo-EN[5693:207] Button PRESSED: 1
2011-11-04 16:26:28.776 Jesolo-EN[5693:207] *** -[NSIndexPath isEqual:]: message sent to deallocated instance 0xe6b6fc0
sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame.
(gdb)
并且在iOS4上说:
2011-11-04 16:28:08.087 Jesolo-EN[5859:207] Button PRESSED: 1
2011-11-04 16:28:08.162 Jesolo-EN[5859:207] *** -[UIAlertView release]: message sent to deallocated instance 0x78c4940
sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
(gdb)
我知道我在使用它之前发布了数据,但是当我在没有启用僵尸的情况下运行应用程序时,它在iOS4和iOS5上运行正常,它会运行一次然后再运行10次。
答案 0 :(得分:0)
我对此并不十分肯定,但你也可以试试这个......
Click on your **project**->go to **info**-> go to **build** section-> in that go to **Deployment** section->then **IOS deployment** section choose the **deployment target to IOS 5** or latest and save and run...
希望它可以帮助你...... :)
答案 1 :(得分:0)
我发现以前工作的ivars的引用现在需要被引用为self.ivar。也许您对managedObjectContext的引用应该是self.managedObjectContext?
答案 2 :(得分:0)
好的,我设法找到解决方案。
不知何故iOS5检测到iOS4中存在的某些对象的释放,我试图找到它们但放弃了。
而不是我打开ARC并评论所有发布和dealloc,我的应用程序做得非常好。我觉得现在它工作得更快。希望这会对某人有所帮助......