Я пытаюсь получить оповещение всплывал с UIAlertController, но я получаю эту ошибку:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target <States: 0x17557b90>.'
UIAlertController бросает NSInvalidArgumentException
if([InAppPurchaseVerifier hasSubscription]){
NSUInteger row = [indexPath row];
NSDictionary *myDict = [[NSDictionary alloc] initWithDictionary:[self.fullList objectAtIndex:row]];
NSString *state = [[NSString alloc] initWithString: [myDict objectForKey:@"0"]];
NSString *stateDetails = [[NSString alloc] initWithString: [myDict objectForKey:@"1"]];
OfficeInfo *anotherViewController = [[OfficeInfo alloc] initWithNibName:@"OfficeInfo" bundle:nil];
anotherViewController.stateName = state;
anotherViewController.stateDetails = stateDetails;
[state release];
[stateDetails release];
[self.navigationController pushViewController:anotherViewController animated:YES];
[anotherViewController release];
}else{
UIAlertController* alert = [[UIAlertController init] alertControllerWithTitle:@"Subscription Needed" message:@"You need to subscribe in order to access that. If you already have a subscription you may need to restore it" preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:YES completion:nil]; // Error throws here
}
'UIAlertController' доступен только в iOS 8. Возможно, вы пытаетесь запустить его на более ранней версии ОС? –
Да, это должно быть. Я тестирую его на своем устройстве iOS 7 ... Таким образом, старая функция предупреждения обесценивается в 8, но мы должны будем использовать ее некоторое время. Хорошо знать! – AndyD273
Да, у вас есть чек и ветка. Это хромает. Возможно, вы можете просто написать обертку. –