第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

NSUserDefaults同步方法

NSUserDefaults同步方法

人到中年有點甜 2019-08-02 16:11:20
NSUserDefaults同步方法NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];[defaults setObject:@"xxxxxxxx" forKey:@"name"];[defaults synchronize];我需要知道為什么我必須使用上面代碼的最后一行[defaults synchronize]?使用它的目的是什么?這是必須的嗎?
查看完整描述

3 回答

?
皈依舞

TA貢獻1851條經(jīng)驗 獲得超3個贊

你不必再寫那行了。

更新文檔中的方法參考

等待默認數(shù)據(jù)庫的任何掛起的異步更新并返回; 此方法是不必要的,不應(yīng)使用。

對該方法的評論解釋了該怎么做。

     /*!
     -synchronize is deprecated and will be marked with the NS_DEPRECATED macro in a future release.

     -synchronize blocks the calling thread until all in-progress set operations have completed. This is no longer necessary. Replacements for previous uses of -synchronize depend on what the intent of calling synchronize was. If you synchronized...
     - ...before reading in order to fetch updated values: remove the synchronize call
     - ...after writing in order to notify another program to read: the other program can use KVO to observe the default without needing to notify
     - ...before exiting in a non-app (command line tool, agent, or daemon) process: call CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication)
     - ...for any other reason: remove the synchronize call
      */
     open func synchronize() -> Bool


查看完整回答
反對 回復(fù) 2019-08-02
  • 3 回答
  • 0 關(guān)注
  • 1097 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號