我尝试了几种方法来使用UIAlertController而不是UIAlertView.我尝试了几种方法,但我无法使警报行动起作用.这是我的代码在IOS 8和IOS 9中正常工作,但是出现了弃用的标志.我尝试了下面的优雅建议,但我无法在此背景下使其发挥作用.我需要提交我的应用程序,这是最后要解决的问题.感谢您的任何进一步建议.我是新手.
#pragma mark - BUTTONS ================================
- (IBAction)showModesAction:(id)sender {
NSLog(@"iapMade: %d", iapMade3);
// IAP MADE ! ===========================================
if (!iapMade3) {
//start game here
gamePlaysCount++;
[[NSUserDefaults standardUserDefaults]setInteger:gamePlaysCount forKey:@"gamePlaysCount"];
NSLog(@"playsCount: %ld", (long)gamePlaysCount);
if (gamePlaysCount >= 4) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Basic"
message: THREE_PLAYS_LIMIT_MESSAGE
delegate:self
cancelButtonTitle:@"Yes, please"
otherButtonTitles:@"No, thanks", nil];
[alert show];
NSString *path = [[NSBundle mainBundle] pathForResource:@"cow" ofType:@"wav"];
_pop =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[_pop play];
[self dismissViewControllerAnimated:true completion:nil];
} else {
if (gamePlaysCount == 1) {
// Create …Run Code Online (Sandbox Code Playgroud)