assignment makes pointer from integer without a cast(赋值使指针从整数而不进行强制转换)
问题描述
我不明白这里有什么问题!在我编译它之后,总是告诉我:赋值使指针从整数而不进行强制转换"我不知道是什么问题!请让我,谢谢.
I don't understand what is problem here! after I compile it, always show me: "assignment makes pointer from integer without a cast" I don't know what is the problem! Please let me, thanks.
保存
NSUserDefaults *percentChecker = [NSUserDefaults standardUserDefaults];
[percentChecker setInteger:0 forKey:percentCheckerSaveKey];
<小时>
加载
NSUserDefaults *percentChecker = [NSUserDefaults standardUserDefaults];
NSString *percentString;
//Alert!
percentString = [percentChecker integerForKey:percentCheckerSaveKey];
推荐答案
这正是它告诉你的.percentString 是一个指针,但 integerForKey: 返回一个整数.将该整数分配给指针是在从没有强制转换的整数中创建指针".为什么要保存一个整数并稍后尝试将其作为字符串加载?
It's exactly what it's telling you. percentString is a pointer, but integerForKey: returns an integer. Assigning that integer to a pointer is making a "pointer from an integer without a cast". Why are you saving an integer and trying to load it later as a string?
这篇关于赋值使指针从整数而不进行强制转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:赋值使指针从整数而不进行强制转换
基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
