简体   繁体   中英

iOS PFUser currentUser - Warning: A long-running operation is being executed on the main thread

I am developing an iOS app using Parse and in my AppDelegate a check whether there is a user logged in or not the way the Parse docs tell you to:

if ([PFUser currentUser]) {
    // User Logged In - do stuff with the user
} else {
   // No User Logged In - Show Login/Sign Up View Controller
}

However, I get the warning "Warning: A long-running operation is being executed on the main thread." on the line [PFUser currentUser] all the time and the app crashes sometimes because of this. I've searched through Parse and all questions related to this have been removed for whatever reason and I am having a tough time figuring this out. I understand that warning but am unaware how to fix it. Any help would be greatly appreciated!

尝试

[[PFUser currentUser] fetchInBackground];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM