Xcode 7 Null传递给需要非null参数的被调用者

问题描述 投票:8回答:3

我更新了xcode 7并给出了此错误

传递给需要非null参数的被调用者的null

 _recorder = [[AVAudioRecorder alloc]initWithURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@.%@", [NSHomeDirectory() stringByAppendingString:@"/Documents"], name, extension]] settings:nil error:nil];
ios xcode
3个回答
31
投票
如果让您感到困扰的是警告,则可以禁止使用此

-Wnonnull


2
投票
一种简单的检查方法是使用Show Completions-转到方法名称,然后按

Ctrl-Space


0
投票
我在使用自定义完成处理程序时遇到了这个问题。在为处理程序传递nil值时发生了警告。因此,我在完成时添加了nil

__nullable

© www.soinside.com 2019 - 2024. All rights reserved.