iOS开发 -- 程序常见错误(不定时更新,适合初学)

1.’There can only be one UIApplication instance.'
instance实例  表示UIapplication只能创建一个实例

2.Application windows are expected to have a root view controller at the end of application launch
window需要一个根控制器。没给,所以给的警告。

3.Control reaches end of non-void function
错误代码:    
+(AVAudioPlayer*)loadMusicPlayer:(NSString *)fileName{
    NSURL *url = [[NSBundle mainBundle]URLForResource:fileName withExtension:nil];
    //AVAudioPlayer *player = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:nil];
    NSError *error;
    AVAudioPlayer *player = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:&error];
    if (error) {
        NSLog(@"%@", error.localizedDescription);
    }
    [player prepareToPlay];
    [player play];
}提示点是这里 显示上述语句
原因是程序是一个方法,末尾要有一个返回值,不能写[player play];这句是一个执行语句,
应该写成return player;


4.Could not find a storyboard named 'Main' in bundle NSBundle
    1、删掉工程中main.storyboard 后要删除plist文件中对应的键值,否则会报如下错误: Could not find a storyboard named 'Main' in bundle NSBundle

    2、删除main.storyboard后,需要在AppDelegate.m中初始化一个window进行使用,否则应用程序没有window可用。


5.iOS编程之xcode报错:Apple LLVM 6.0 Error的解决方法
一般来说,这个错误是由于更新了xcode的版本,或者是删了之前的,又重装了一遍xcode,就时不时会出现此问题
Finder前往--option找到资源库--Developer--Xcode--DerivedData 这个文件夹对应程序的文件删除,重新运行一遍项目就可以了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值