UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

iCloud Drive path returning nil

Forums > SwiftUI

I am getting a nil returned for the path to my iCloud Drive container. I cannot seem to figure out why. I have setup all the capabilities as well:

Under my target:

  1. iCloud Documents is checked
  2. The correct container is checked
  3. I have modified the plist

I am using the following line to get the URL for my iCloud Documents

path = FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents")

This is returning nil, can someone help me with this.

Thanks, Mark

3      

I'm having the same issue when trying to view my UI in the canvas, the app crashes stating my "path" (your variable) is nil. When I run it in the simulator, everything is fine.

3      

Did you ever solve this problem? I am having exactly the same problem and it happens on the simulator also.

Thanks,

2      

Might be worth checking your code/setup against these articles: iCloud drive project setup and Updating the metadata of iCloud containers for iCloud Drive.

Gavin

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.