Obj-C,NSScanner:nil 字符串参数,突然收到此警告,我该如何解决? [英] Obj-C, NSScanner: nil string argument, suddenly getting this warning, how do I fix it?

查看:56
本文介绍了Obj-C,NSScanner:nil 字符串参数,突然收到此警告,我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我突然在调试窗口中收到此警告 NSScanner: nil string argument.

I'm suddenly getting this warning NSScanner: nil string argument in the debug window.

我突然说,但我不知道是哪个代码导致的.

I say suddenly, but I've no idea from which code has caused it.

我该如何解决这个问题?

How do I resolve this problem ?

推荐答案

在使用它创建 NSScanner 之前检查字符串是否为 nil,因为您可能使用

You check if the string is nil before creating the NSScanner with it, as you are probably creating it with

+ (id)scannerWithString:(NSString *)aString

- (id)initWithString:(NSString *)aString

没有办法改变 NSScanner 字符串,一旦它被创建,编译器只是告诉你用 nil 字符串创建一个 NSScanner 是没有意义的.

There is no way of changing the NSScanner string, once it has been created, the compiler is just telling you that it is pointless to create a NSScanner with a nil string.

这篇关于Obj-C,NSScanner:nil 字符串参数,突然收到此警告,我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆