【问题标题】:Xcode 4.5 causing errors in iOS 5 appsXcode 4.5 导致 iOS 5 应用程序出错
【发布时间】:2012-09-23 15:51:22
【问题描述】:

自过去 3 到 4 个月以来,我一直在开发计时器应用程序(当时没有 iOS 6 的迹象),但由于某些问题无法完成。现在自从 iOS 6 出现以来.. 我的代码出现错误。我最近下载了 xcode 4.5 和 iOS 6 SDK(在其中)。现在当我运行应用程序时。它在不同的场合崩溃。有时在启动时立即崩溃。有时根本没有崩溃。 有时会给我 SGBRT 错误。有时 Bad_exc 错误(内存错误)。我不知道如何处理这个。我已经下载了 iOS 5.1 模拟器,并在我运行应用程序时下载了该模拟器。完全没有崩溃,但是当我在 iOS 6 模拟器上运行应用程序时。哇!它立即崩溃。 我急需指导。任何遇到相同错误并对其进行故障排除的人也请帮助我。 提前致谢 法赫德。 -附言我添加了断点来检测错误,我只能捕获一个但不明白为什么会出现这个错误。代码如下:

-(void) playAppSound:(NSString *) fName withExt:(NSString *) ext{
  NSString *path  = [[NSBundle mainBundle] pathForResource : fName ofType :ext];
  if ([[NSFileManager defaultManager] fileExistsAtPath : path])
  {
      NSURL *pathURL = [[NSBundle mainBundle] URLForResource:fName withExtension:ext];
      // Instantiates the AVAudioPlayer object, initializing it with the sound
      if(self.appSoundPlayer)
      {
        if([self.appSoundPlayer isPlaying])
        {
            [self.appSoundPlayer stop];
            [self.appSoundPlayer release];
        }
      }
  //Thread breaks down in the next line self. appSoundPlayer...

    self.appSoundPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: pathURL error: nil] ;

    //self.appSoundPlayer.numberOfLoops = 1;
    [appSoundPlayer setDelegate:self];
    [appSoundPlayer prepareToPlay];
    //[appSoundPlayer setVolume:1.0];
    [appSoundPlayer play];
}
  else{
   //   NSLog(@"error, file not found: %@", path);
  }
}

【问题讨论】:

    标签: ios ios5 ios-simulator ios6


    【解决方案1】:

    检查框架版本(SDK 5

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-03
      • 2013-11-06
      • 2022-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多