简体   繁体   中英

How to save a file to iCloud Drive from my ios app?

What do I need to do for my app to save a file to iCloud? I have added the iCloud capability in the Signing & Capabilities. However, I don't understand what permissions I need to put in the info.plist file.

I created a UIActivityController and send it a URL of the file. Then when I click on Save To Files I see the option to save to iCloud but it's dimmed. Please see screenshots. Save To Files iCloud Dimmed

在此处输入图像描述

在此处输入图像描述

Here is my code:

let fileURL = folderUrl.appendingPathComponent(self.crapsSession.fileName).appendingPathExtension("csv")
                        
let items = [fileURL]
let ac = UIActivityViewController(activityItems: items, applicationActivities: nil)
self.present(ac, animated: true)

I've searched all over the internet but couldn't figure out what to do. Thanks for helping a noob.

Thanks for helping. The screenshot is from the simulator. When I loaded to a real device, the iCloud option is no longer dimmed.

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