TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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 RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.