在應用程序執行有時我得到這個錯誤:iOS的分析和對象 - C:PFKeychainStore無法設置對象鍵「currentUser」
PFKeychainStore failed to set object for key 'currentUser', with error: -34018
它並不總是發生,只是有時候。 例如,我在viewDidLoad中運行此代碼
NSLog(@"%@", [PFUser currentUser]);
if ([ManageConnection isWiFi] || [ManageConnection isFastConnection]) {
[[PFUser currentUser] fetchInBackgroundWithBlock:^(PFObject * _Nullable object, NSError * _Nullable error) {
if (error != nil) {
[ParseErrorHandlingController handleParseError:error];
}
else {
self.user = (PFUser *)object;
當我在控制檯上打印[PFUser currentUser]價值,它的存在
<PFUser: 0x6080000e8980, objectId: 5ZgXxNrT5C, localId: (null)>
但當我嘗試獲取用戶我得到上述錯誤。有什麼建議麼?
我正在使用最新版本的Parse。
嗨朱塞佩,我有點混淆在這裏。 您只能通過[PFUser currentUser]獲取當前用戶,那麼爲什麼您需要在後臺再次獲取? –
嗨@SatishMavani,你知道我不是代碼的所有者,只是修復一些錯誤。之前的開發者寫了這個func。無論如何,我經常會遇到這個錯誤。 –
@SatishMavani我發現爲什麼有那個「抓取」。在viewDidLoad中,我需要[PFUser currentUser]對象的值。由於該值可能會發生變化,因此我必須更新我的[PFUser currentUser]對象。 –