简体   繁体   中英

App rejection due to use of CloudKit

I have an app that's been rejected because I test whether the user has access to their CloudKit containers.

If they are not connected, I issue a warning, and tell them to quit the app.

I can't be the only one to experience this.. Any one have a workaround?

Thanks..

For information, the code I'm using to test was sent to me from an Apple TSI engineer. sigh..

Here it is:

func isICloudContainerAvailable()->Bool {
    print(#function)
    CKContainer.default().accountStatus { (accountStatus, error) in

        if accountStatus == .available {
            print(#function, "accountStatus 1: ", accountStatus)
            return

        } else {
            print(#function, "accountStatus 2: ", accountStatus)
        }   

        DispatchQueue.global().asyncAfter(deadline: .now() + 0.3) {

            guard error != nil, accountStatus != CKAccountStatus.available else {return}
            print( #function, "accountStatus 3: ", accountStatus)
            print("iCloud account is not available! Be sure you have signed in iCloud on this device!")
        }
    }

    if FileManager.default.ubiquityIdentityToken != nil {
        print("User logged in")
        return true
    }
    else {
        print("User is not logged in")
        return false
    }   
}

And the function is used here:

if !isICloudContainerAvailable() {

    let alertController = UIAlertController(title: "Uh-oh", message: "You must be signed into iCloud \nto use this app.\nPlease quit, log in to iCloud using the 'Settings' app\nand try again", preferredStyle: .alert)

                let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
                alertController.addAction(defaultAction)

                self.present(alertController, animated: true, completion: nil)

            })

You are not allowed to make you app non functional without CloudKit access. You are only allowed to ask the user to login into iCloud to get the full functionality of the app. It does not matter how (un)functional your app is without CloudKit access. Maybe you could show an instruction screen or some general info about the app. You can then also implement detection of iCloud login and automatically reinitialise your app so that the user does not have to quit (actually kill) and start it again.

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