iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
Buffer2Disk
V2EX  ›  iDev

关于 NSUserDefaults 的使用

  •  
  •   Buffer2Disk · Aug 20, 2019 · 6564 views
    This topic created in 2593 days ago, the information mentioned may be changed or developed.

    如题,使用的环境是 OSX 10.14.6

    使用 NSUserDefaults 存储了一些数据到 plist 文件,

    然后使用 cleanMyMac 卸载了该软件(.app 文件 和 .plist 文件都被清除)

    然后再次安装的时候,发现该软件竟然能够自动读取出来之前存储的数据

    但是如果此时重启了电脑的话,这些数据就被清理掉了。

    相同的操作在 OSX 10.12 上,清空数据重新安装,再打开后默认就是空的

    请问这是 NSUserDefaults 的什么原理呢? 有没有什么办法不重启,彻底清理掉存储的数据呢?

    3 replies  •  2019-09-09 17:27:08 +08:00
    Delon
        1
    Delon  
       Aug 20, 2019
    killall cfprefsd
    终结此贴
    Buffer2Disk
        2
    Buffer2Disk  
    OP
       Aug 21, 2019
    @Delon 能介绍的详细一点嘛?比如这是 NSUserDefaults 的什么原理呢?
    wellcheng
        3
    wellcheng  
       Sep 9, 2019
    NSUserDefaults 本质就是 plist 文件,但是会在内存里有一份缓存
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2531 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:43 · PVG 12:43 · LAX 21:43 · JFK 00:43
    ♥ Do have faith in what you're doing.