GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

UltimatePortfolio Project: Unable to initialize without a valid iCloud account

Forums > SwiftUI

I am following the UltimatePortfolio app video series and am on Video 6: Showing, deleting, and synchronizing issues. The app is designed to sync using iCloud.

When I try to build and run the app I get the following error: Domain=NSCocoaErrorDomain Code=134400 "Unable to initialize without a valid iCloud account.

I am confident I have set up iCloudKit in the app as described by Paul. I have also logged into my iCloud account and iCloud Drive on the simulator (I'm simulating an iPhone 14 Plus) which I found from web searches was often sited as the issue but I still get the error.

Any ideas on cause and correction? I'm pretty much at a standstill for this project until I can get the iCloud issue resolved.

Thanks.

2      

Do you have an active Apple Developer Account? You need one for CloudKit support in your app.

https://developer.apple.com/help/account/reference/supported-capabilities-ios

2      

Thanks for the thought but I do have an active account. Realized at start of project I would need one for the CloudKit integration.

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 and A/B test your entire paywall UI without any code changes or app updates.

Learn more here

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

Hm, this happens for me always with the Watch Simulator. This doesn't work and never syncs.

You can try to reset the Simulator or delete it and create a new one. I don't know how many hours I wasted with fixing a "bug" which was simply a Simulator issue.

2      

I was going to say that the simulator is very hit and miss! Have you tried on real device and see if get the same error! It will only be a problem when syncing with other devices, which means that you can carry on with the rest of the project.

2      

I just tried running the app on my iPad and get the same crash.

So I build and start the app, the app opens on the device but with no UI elememts, just a blank screen, the iCloud account error shows up in the Debug Area and the app just does nothing. After a short while (30 seconds or so) I also get a bad memory access exception: (@main) Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ff7b0977ff8).

Not sure what is causing what at this point.

I guess I could turn off the iCloud syncing but a focus of the project is iCloud syncing so if I can get it running would be preferable. May have to go through code line-by-line and see if there is something I can find or perhaps copy/paste Paul's code in the writeup for each video if all else fails.

2      

Bad memory access exception could mean you want to access f.e. an optional or an attribute which doesn't have a value.

2      

2      

I have a different problem. My data syncs perfectly on different simulators that are logged into the same iCloud account. But when i put the app on testflight to test this on my devices, they dont sync. Is this beasue I'm using testflight?

2      

I'm currently immersed in the UltimatePortfolio app video series, specifically delving into Video 6, which covers showcasing, deleting, and syncing issues within the application. The app's architecture is built around seamless synchronization utilizing iCloud.

However, upon attempting to execute the app, I encountered an error message that reads: "Domain=NSCocoaErrorDomain Code=134400" with the accompanying note stating, "Unable to initialize without a valid iCloud account."

Despite meticulously following Paul's instructions on integrating iCloudKit into the app, and ensuring my iCloud account is logged in along with iCloud Drive within the simulator (emulating an iPhone 14 Plus), the error persists. I've conducted thorough web searches which commonly attribute this issue to simulator settings, yet the problem persists unabated.

I'm currently at an impasse with this project until I can resolve the iCloud synchronization snag. Any insights or guidance on diagnosing and rectifying this matter would be immensely appreciated www.junkrecolet.com

1      

@vandan Did you deploy your database schema to production in CloudKit console on your developer portal?

@barbaradabney36
Do you have an active Developer Account with Apple, you need one for CloudKit integration in your app.

1      

A bad memory access exception typically occurs when attempting to access an optional or an attribute that doesn't have a value. Check this [sunasusa.com]

   

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 and A/B test your entire paywall UI without any code changes or app updates.

Learn more here

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

Reply to this topic…

You need to create an account or log in to reply.

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.