NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills 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.



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


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


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.


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.


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.


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



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 October 1st.

Click to save your free spot now

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.