简体   繁体   English

尝试从NSInvocation获取NSString类型参数时发出警告

[英]Warning when trying to get NSString type argument from NSInvocation

I want to get argument passed in, I already got the NSInvocation instance. 我想传递参数,我已经有了NSInvocation实例。 I tried: 我试过了:

NSString *firstArg;
[invocation getArgument:&firstArg atIndex:2];// Warning here.

But I got warning: 但是我得到警告: 在此处输入图片说明

How to get rid of it? 如何摆脱它?

getArgument requires Nonnull , you have not initialized your NSString so, getArgument需要Nonnull ,您尚未初始化NSString所以,

change your code as below: 如下更改代码:

NSString *firstArg=nil;
[invocation getArgument:&firstArg atIndex:2];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM