简体   繁体   English

我可以在iOS的挂起模式下从userdefault获取数据吗?

[英]Can i get the data from userdefault in suspended mode in ios?

I am creating an application on beacon. 我正在信标上创建一个应用程序。 In beacon when the application in suspended mode that time also called -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region when i am entering particular region but i want is data from the NSUserDefaults and set it to local notification. 在信标中,当我进入特定区域但我想要的是来自NSUserDefaults数据并将其设置为本地通知时,当应用程序处于挂起模式时,该时间也称为-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region I have already set a data in to NSUserDefaults when the application enter to region i want to get a data from the userdefault. 当应用程序进入我要从userdefault获取数据的区域时,我已经在NSUserDefaults设置了数据。

I have heard a similar report of this in a deleted answer to a question here: https://stackoverflow.com/a/34347464/1461050 . 我在以下问题的答案中已听到类似的报告: https : //stackoverflow.com/a/34347464/1461050 Since you probably cannot see that question, here is what the user reported: 由于您可能看不到该问题,因此用户报告了以下内容:

I have an extremely annoying bug in iOS: 1. Phone battery is done and it is recharge. 我在iOS中有一个非常烦人的错误:1.手机电池已完成,正在充电。 2. App is being waken in the background by a beacon detection (car beacon in our case). 2.正在通过信标检测(在我们的例子中是汽车信标)在后台唤醒应用程序。 3. AppDidFinishLaunchWithOptions is being called (as expected) 4. the NSUserDefault values at that time are null (it appears that it is related to the fact that NSUser defaults are under some kind of protection). 3.调用AppDidFinishLaunchWithOptions(按预期方式)4.当时的NSUserDefault值为null(这似乎与NSUser默认值受到某种保护这一事实有关)。

I have not reproduced this myself, but figured it is worth sharing that other folks have reported having trouble getting access to NSUserDefaults in certain modes. 我没有NSUserDefaults复制此内容,但值得一提的是其他人报告在某些模式下无法访问NSUserDefaults

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将推送通知数据存储到 UserDefault iOS Swift - Storing Push Notification Data into UserDefault iOS Swift 当应用暂停时,iOS8 CoreMotion从startActivityUpdatesToQueue获取更新 - iOS8 CoreMotion get updates from startActivityUpdatesToQueue when the app is suspended 如何从AnyObject转换UserDefault值? 到一个整数,所以我可以保存它 - How do I convert a UserDefault value from AnyObject? to an Int so I can save it ios 应用的 UserDefault - UserDefault for ios App iOS:我可以从加速度计数据中获得俯仰/偏航/滚动吗? - iOS: Can I get the pitch/yaw/roll from accelerometer data? 即使用户覆盖50米,当应用程序未在ios10的后台运行(暂停)时,如何每隔n秒获取当前的GPS位置? - How can I get current GPS location in every n seconds when app is not running in background (suspended) for ios10 even if user covers 50 meters? 如何在UserDefault中存储推送通知警报消息? - How can I store Push Notification alert message in UserDefault? 从 userdefault 中删除值不起作用 :: userdefault 问题 - removing value from userdefault is not working :: Issue with userdefault 使用USerDefault保存数据时我在做什么错 - What am I doing wrong on using USerDefault to save data 从暂停状态的iOS恢复野生动物园 - Resume safari from suspended state iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM