IPhone SDK Default NSUserDefaults

后端 未结 3 1573
你的背包
你的背包 2021-01-15 10:32

I have set up the user defaults to record a integer for a UISlider, the problem is that, if the user has only just installed the app then the integer is zero or NULL. Is the

3条回答
  •  一个人的身影
    2021-01-15 11:20

    Just ask for objectForKey:. If it isn't set, it will return nil.

    Your test doesn't work, because integerForKey: with an unset value will return 0, which is nil, which is NULL. The differences between them only exist to the compiler.

提交回复
热议问题