是什么原因导致“NSScanner:nil string argument”?
当我将数据保存到核心数据时,我收到此消息。
NSScanner: nil string argument
我没有使用任何 NSScanner 方法。它从哪里来?
这是一个错误吗?我应该用它做什么?
谢谢帮忙,拜托。
I got this message when I save data to core data.
NSScanner: nil string argument
I didn't use any NSScanner method. Where did it come from?
This is a bug? What should I do with it?
Thanks help, please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据经验,我可以说
-[NSDecimalNumber initWithString:]
或+[NSDecimalNumber DecimalNumberWithString:]
与nil
字符串是导致的一件事该日志消息。在
-[NSScanner initWithString:]
上设置一个断点开始;如果您没有这样理解,请尝试使用其他可能创建扫描器的方法,例如+scannerWithString:
和-[NSConcreteScanner initWithString:]
。这就是我清除不需要的日志语句的方法。From experience, I can say that
-[NSDecimalNumber initWithString:]
or+[NSDecimalNumber decimalNumberWithString:]
with anil
string is one thing that causes that log message.Set a breakpoint on
-[NSScanner initWithString:]
to start with; if you don't catch it that way, then break on the other ways you might create a scanner, like+scannerWithString:
and-[NSConcreteScanner initWithString:]
. That's how I flushed my unwanted log statement out.FWIW,我在构建核心数据应用程序时出现了此消息。
这是因为我在模拟器中重建并运行了应用程序,这有效地终止了正在运行的进程,而无需执行任何退出方法。
根据您保存托管对象上下文的时间/位置,您可能会在某个地方留下不完整的托管对象,然后当应用程序重新启动并且从商店返回半成品对象时,期望找到值的扫描仪将什么也没有。 。
FWIW, I had this message come out whilst building a core data app.
It was due to me rebuilding and running the app in the simulator, which effectively kills off your running process without going through any of your exit methods.
Depending on when / where you are saving your managed object context, you could be left with an incomplete managed object somewhere, then scanners which would expect to find values would have nothing when the app was relaunched and the half baked objects were returned from the store.
我有相同的崩溃日志
NSScanner: nil string argument
。这是我的情况,
dequeueReusableCellWithIdentifier
崩溃,解决了它
我通过Product->Clean ,然后重建。一切对我来说都很好。我不知道为什么会发生这种情况。
I have the same crash log
NSScanner: nil string argument
.This is my sitution
dequeueReusableCellWithIdentifier
only on simulatorI solved it by
Product->Clean Then rebuild.Every thing works fine for me. I not sure why this happened.
我在 iOS 9 和 iOS 10 上遇到了这个问题,但 iOS 11 工作正常,我通过在使用 KVO 的
dealloc
中删除观察者来解决它。例如:
I had met this problem on iOS 9 and iOS 10 BUT iOS 11 work fine,I solved it by removing observer in
dealloc
where I had used KVO.Such as:
我收到此崩溃错误,但与
nil string
问题无关。我的原因是我在故事板中使用动态单元格,但在属性检查器中设置静态单元格。我将该属性更改为动态原型,解决了问题。
I got this crash error but not about
nil string
issue.My reason is that I use a cell in storyboard as dynamic but set
Static Cells
in the Attributes inspector. I changed that attribute toDynamic Prototypes
, solved the problem.