Setup CloudKit in SwiftUI project and get user info | Advanced Learning #21

  Рет қаралды 24,022

Swiftful Thinking

Swiftful Thinking

Күн бұрын

Пікірлер: 71
@mke579
@mke579 3 жыл бұрын
Nick! You don't know how much I've been looking for a complete CloudKit tutorial :O... This will save my ass soooo much! Keep up this awesome series and I hope you can cover all CloudKit functionalities as much as you can because I was really looking forward to see the power that CloudKit can give. Thank you again!
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hey MKE! Well I have 5 CloudKit videos so far, it's not a "complete" tutorial but should cover most use cases (enough to build most apps at least). At the end, if there's anything major I missed, definitely leave a comment letting me know 🤙
@mke579
@mke579 3 жыл бұрын
@@SwiftfulThinking 5 videos, awesome! It's gonna be lit! Looking forward to learn some new stuff :D
@Connor-pj2tg
@Connor-pj2tg 3 жыл бұрын
This is amazing Nick! Thank you. I can't wait to see more CloudKit videos!
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Thanks for watching Connor!
@chrislangston929
@chrislangston929 2 жыл бұрын
Thanks Nick! Followed your Tutorial and it worked like a champion. Appreciate you putting this out to the community.
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Happy to hear that! Thanks for watching.
@akhilpillay2486
@akhilpillay2486 24 күн бұрын
Honestly, you are so effortlessly funny in your remarks bro, you earned a sub just for that🤣 Great video too thanks brother, helps a lot
@adamcm82
@adamcm82 4 ай бұрын
It’s the future, please do a full playlist for CloudKit, specifically SHARING 😅
@bbulliard
@bbulliard 2 жыл бұрын
You have a gift for teaching. Very clear,easy to understand code. Great job. I’ll have to add more coffee money to your account to keep you going..bob
@Awesome奥深
@Awesome奥深 3 жыл бұрын
Awesome to watch, I am keeping waiting for you updates.💎
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
I love to hear that lol I have a bunch of videos in the queue for you 🤓
@degisner
@degisner 3 жыл бұрын
Finally! Nick, you're the best! I became a developer watching your channel. P.S. I'm a UI designer.
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
That's awesome to hear haha .. and a great combination of skills to have 😎
@이가은-c4g
@이가은-c4g Ай бұрын
Hi! Thank you for making this video! It's so helpful for learning how to develope the iCloudKit. BTW, I have one question: at 14:29 in this video, how did you make that func to choose and make a Vstack? Thanks,
@arkemal
@arkemal Жыл бұрын
Hi Nick, very nice intro and well explained tutorial!
@markmartin4037
@markmartin4037 5 ай бұрын
Is cloudkit still worth learning? If so I'd love to see a playlist.
@lance2301
@lance2301 2 жыл бұрын
Great video, thanks for creating content around CloudKit. Been a big fan of CK since the beginning but there has always been a lack of good documentation and learning resources on the topic.
@ملاك-ح5م2ث
@ملاك-ح5م2ث Жыл бұрын
Thank you so much Nick ❤
@dr.craigcurphey4829
@dr.craigcurphey4829 2 жыл бұрын
Great job as usual, Nick! You have a genuine knack for hitting the things that matter. Question of the sequence of events ... first you call getiCloudStatus, which does an CKContainer api (I assume this is asynced, right?), immediately you call requestPermission. Could the CKContainer api not yet be complete when you call requestPermission, or is the getiCloudStatus always going to be done executing before requestPermission is called? I don't quite understand - does the requestPermission func need isSignedInToiCloud to be true for the func to give the correct result, or does it not matter whether the user is signed in for requestPermission to work? Thanks for your help!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Great question as always! This is all async code, so yes timing definitely matters here. The app is automatically connected to the CKContainer and CloudKit, so we don't have to worry about that here. We do, however, need the user to be signed in to their iCloud account before they can access CloudKit. So the first function to call is getiCloudStatus() and then after that you can call requestPermission(). Almost all of the time, getiCloudStatus() will immediately return successful though. I don't know anyone using an iPhone that isn't signed in to an iCloud account. In production, I would probably call these one-after-another just in case. If the user getiCloudStatus() does fail, though, I would probably stop everything else in the app and show a screen saying "sign in to iCloud to continue" or something like that. Also, in reality, the getiCloudStatus() can be called at app launch in the AppDelegate or something like that, while requestPermission() might called much later in the lifecycle, such as during onboarding or after creating an account.
@DNeutron0
@DNeutron0 2 жыл бұрын
Would you release a CloudKit playlist?
@wandahu8058
@wandahu8058 Жыл бұрын
Good!
@Connor-pj2tg
@Connor-pj2tg 3 жыл бұрын
Hi Nick. Quick question. Despite requesting permission, the returnedStatus is always could not complete. Did you have any experience with this, or any tips to fix this issue?
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Are you signed into an iCloud account on the device?
@Connor-pj2tg
@Connor-pj2tg 3 жыл бұрын
@@SwiftfulThinking yes. The weird thing is, I created another container and it worked fine, just not on the original one. Perhaps just a bug
@evangelosspyromilios5994
@evangelosspyromilios5994 8 ай бұрын
on 22:42 is there any way to fetch the actual name of the user, for example if the iCloudAccountStatus is .available, to show something like "Hello Nick Sarno !" ? (Edited 10 seconds later: OK got it !!)
@DavidM979
@DavidM979 Жыл бұрын
A lot of these functions from CloudKit got deprecated in iOS 17. Finding it really hard to understand what replaces them now.
@leomota04
@leomota04 Жыл бұрын
any updates? im struggling....
@Spacer-l3j
@Spacer-l3j 5 ай бұрын
this is the problem with the content creators... they don't care to update the videos... so useless and waste so much time... i know it is free but make us aware that many of the functions are depricated for god's sake
@developer.yilmazer
@developer.yilmazer 6 ай бұрын
Thank you for sharing such helpful content! I've learned a lot from this video.
@CandiceKhannaApps
@CandiceKhannaApps 3 жыл бұрын
I’ve been waiting for this 👏🏽
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
😎🤓🥳
@WeirdTKJackson
@WeirdTKJackson Жыл бұрын
Hi, much thanks for your courses, I learned a lot really. Now, I can use CKContainer to CRUD public database of my container, which I can call it as "online mode" of my APP. But, if there is a "offline mode" of my APP, I use Core Data to read and write, how can these operations synchronze to the public database? Since I know, the NSPersistentCloudKitContainer support privdate database well and thought supports public database but now very well. I think in the offline mode of my APP, to enable data synchronization to public database when network is available, I have to continue to use Core Data and use CKContainer to manually upload loal changes to public database. Am I right?
@dennismallette258
@dennismallette258 2 жыл бұрын
The permissions pop up does not come on my screen, does anyone know why it is not working?
@cibarra_dev
@cibarra_dev 2 жыл бұрын
Project Target / Signing & Compatibility/ iCloud / Container. Try making a new container
@bobearl99
@bobearl99 Жыл бұрын
Hi Nick, Fantastic tutorial as always. I found one small issue that tripped me up several times when I tried to request application permissions using async await, and I thought I'd add it here in case others who follow your series hit the same snag. I kept getting a notice in the console: [CK] Could not validate account info cache. (This is a potential performance issue.). When I requested permission in the app, the oddly-worded dialog you mention at 30:10 came up, but when I clicked 'Allow', it fails to return a CKPermissionStatus. The fix is perhaps obvious to most, but took me most of a day to figure out: you have to go to the CloudKit Console. . . Indexes and create an index for the Users. The 'validate info cache' message goes away, and the permission status is set to granted. Keep up the great work!
@bobearl99
@bobearl99 Жыл бұрын
A quick follow up: if I failed to index the Users before I requested permission, I could not reset the simulator to re-ask for permission (for example, no luck when trying to Reset Environment from the CloudKit Console, or even creating a new CloudKit database and indexing the Users). The only solution that I could find was to create an entirely new project, add the CloudKit capability, index the Users, and then request permission.
@EliHartnett
@EliHartnett 2 жыл бұрын
Do you post the source code for your videos anywhere online? They are awesome by the way
@lincolndickerson1293
@lincolndickerson1293 2 жыл бұрын
The reason you cannot delete a cloudkit container is because Apple protects user data at all costs. The data in the apps CloudKit container belongs to the user not the app. To most it seems reasonable that before release there shouldn’t be any user data but Apple isn’t going to take on that burden when it comes to beta testers and sorting it out.
@Decatilinae
@Decatilinae 3 жыл бұрын
Hello Nick, as always, you are super... May I ask one question: I am based in the EU, and according to the DGPR law, how does CloudKit work under the hood? Is cloud kit safe for hack attacks or similar? Thanks for your attention
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Hey Romesh! CloudKit is provided and maintained by Apple, so I'm sure it is very safe to use. Here is a quick link with some info: support.apple.com/guide/security/cloudkit-security-sec3d52c0374/web
@trungnguyenthanh9233
@trungnguyenthanh9233 Жыл бұрын
Nice content bro
@zxccxz9283040
@zxccxz9283040 Жыл бұрын
All the calls to CloudKit that you are doing are done asynchronously. so how are you ensuring that they run one after the other?
@WeirdTKJackson
@WeirdTKJackson Жыл бұрын
He doesn't talk about NSPersistentCloudKitContainer instead of CKContainer. I don't know why.
@dr.craigcurphey4829
@dr.craigcurphey4829 2 жыл бұрын
In the case where the user has temporarily no access to the internet, is Cloudkit smart enough to store new records created by the app locally then fire the records out to the cloud when the connection is re-established, or is the app dead while disconnected? Thanks!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Hey Craig! Hope all is well with you.... No, CloudKit isn't that smart. I believe we can integrate it with CoreData to do this but honestly, I'm not familiar enough to say for sure. Regardless of using CloudKit, many apps will implement a fall back to temporarily save data in UserDefaults or CoreData while the user is offline.
@thejaplong
@thejaplong 2 жыл бұрын
I am getting signed in = true, but permission: False; no chance to give permission . Maybe there is a simulator setting i haven't set ?? thanks for help
@thejaplong
@thejaplong 2 жыл бұрын
OK, fixed it ! I didn't realize that (apparently) the iCloud container's name must be identical to the bundle identifier. At least making this change worked for me !
@georgebarlowr
@georgebarlowr 2 жыл бұрын
@@thejaplong They don't have to be but it makes it a lot easier to setup if they are, since I believe if you want a different bundle identifier you have to manually initialise CKContainer whatever it is with that bundle identifier.
@dennismallette258
@dennismallette258 2 жыл бұрын
I get the same problem, I can’t get the permission window to come on the screen, I read that a lot of people are having the same issue, I tried resetting the environment in CloudKit but it still will not show the permission popup… my identifier and container are the same name… I will look into manually initializing the container as George mentioned… but I don’t know how to do that…
@Mitglied99
@Mitglied99 2 жыл бұрын
@@dennismallette258 just add a let container = CKContainer(identifier: "YOURCONTAINERID") and then use in requestPermission() container.requestApplicationPermsission... instead of CKContainer.default()
@sonumartin3253
@sonumartin3253 2 жыл бұрын
Does any way to get user's phone number without giving phone number? if not any apple documentation that specifies we can't get phone number ?
@tomqin3685
@tomqin3685 2 жыл бұрын
Hi! I got the permission pop up when i following to your video, but when i came to my little demo , with using same code and same Cloud Containter or new, I didn`t get the pop up ...😢😢😢 , and I found that the returnedStatus in requestPermission is returning [.couldNotComplete] instead of [.granted]
@mysterouis30
@mysterouis30 2 жыл бұрын
Did you get it to send the notification? Im having the same issue where the pop up notification isnt showing
@tomqin3685
@tomqin3685 2 жыл бұрын
@@mysterouis30 Try copy your bundle id into the input box when adding your containers of iCloudkit, It working on my new project😅
@mysterouis30
@mysterouis30 2 жыл бұрын
@@tomqin3685 I got it to work, i just manually initialized the container instead of using CKContainer.default()
@burakimdat7488
@burakimdat7488 Жыл бұрын
I did same coding with video. I can get user name and surname but email and phone is empty. Does anyone know why ?
@dr.craigcurphey4829
@dr.craigcurphey4829 2 жыл бұрын
Nick are you willing to do a video on sharing my privateCloudDatabase with another user? I have a clinic database for iPad & iPhone and I can use it but my wife can’t unless she logs out then logs in as me! I have spent weeks trying to learn how to do this, yet Apple documentation is most difficult as to be useless!
@SwiftfulThinking
@SwiftfulThinking 2 жыл бұрын
Hey Craig, I honestly don’t know enough about this to do an in-depth video any time soon. I know it is definitely possible without having to sign into each other’s accounts. There should be some documentation online around CKShare, but I think you need to set up Zones first - which is a whole topic in itself. I did a poll recently on topics to cover and there wasn’t much interest in CloudKit, so I’m not sure when I’ll get to this. On the brightside, Firebase ranked pretty high, which I know I promised you a while ago 😭😅
@ThePhotodiver
@ThePhotodiver 3 жыл бұрын
I was able to login to my iCloud account on the device simulator, but the status and permissions both say false. Not sure if this is the problem or not, but my Xcode account is different from my iCloud account with different logins.
@SwiftfulThinking
@SwiftfulThinking 3 жыл бұрын
Did you figure this out? I don't think the iCloud account will matter. Maybe the Container isn't set up fully?
@ThePhotodiver
@ThePhotodiver 3 жыл бұрын
@@SwiftfulThinking I am pretty sure it is setup properly as I can save items to the cloud and display them in a list. Not sure what I might be missing.
@AntonR8
@AntonR8 Ай бұрын
Its deprecated
@calebyates253
@calebyates253 Жыл бұрын
You should probably black out the name that came back from your iCloud account, now we know your real name is Nick
@MarkVolkmann
@MarkVolkmann 2 жыл бұрын
The call to requestApplicationPermission fails for me. I get CKApplicationPermissionStatus(rawValue: 1) and the error messages "Service Unavailable", "Request failed with http status code 503".
@MarkVolkmann
@MarkVolkmann 2 жыл бұрын
It's working now! I think I wasn't signed into iCloud in the Simulator.
CloudKit CRUD Functions in SwiftUI project | Advanced Learning #22
53:40
Swiftful Thinking
Рет қаралды 12 М.
CloudKit - Intro, Pricing, Terms, & Definitions
17:26
Sean Allen
Рет қаралды 23 М.
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3 МЛН
Create a custom navigation bar and link in SwiftUI | Advanced Learning #12
47:26
How to Get User Location on a Map - Swift
26:11
Sean Allen
Рет қаралды 65 М.
The M4 Mac Mini is Incredible!
11:45
Marques Brownlee
Рет қаралды 4,3 МЛН
Which Database Type Should I Use For My App?
18:15
IAmTimCorey
Рет қаралды 47 М.
My Images CD Part 7 - CloudKit Sync with Core Data
18:42
Stewart Lynch
Рет қаралды 3 М.
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Рет қаралды 49 М.
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН