This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center




7年前关闭。




我有这个
#define sud [NSUserDefaults standardUserDefault]

然后我用[sud integerForKey:key]

编译警告:
Class method '+standardUserDefault' not found (return type defaults to 'id')

运行时错误:
+[NSUserDefaults standardUserDefault]: unrecognized selector sent to class 0x3c0bc850

但是我可以在没有任何警告的情况下使用另一个:
#define man [Manager sharedManager]

其中“人”是游戏经理(单人),用于存储游戏得分等

最佳答案

这是standardUserDefaults(带有s)。

两种风格注释:

  • 可可粉不鼓励使用缩写。
  • 您应该考虑删除宏,因为它们会使代码的可读性和可读性降低,如您的错字错误所示。
  • 10-08 16:58