Build apps that share data through CloudKit and Core Data

RSS for tag

Discuss the WWDC21 session Build apps that share data through CloudKit and Core Data.

Posts under wwdc21-10015 tag

34 Posts

Post

Replies

Boosts

Views

Activity

Provisioning issue with CoreDataCloudKitDemo
I've been struggling to get the CoreDataCloudKitDemo working. I've updated to Xcode 13 and followed the documented instructions closely. However, I'm getting this error: Provisioning profile "Mac Team Provisioning Profile: com.____.apple-samplecode.CoreDataCloudKitDemo" doesn't include the aps-environment entitlement. A bit of searching says this error is due to Push Notifications not being enabled. However, I do have them enabled. I cannot figure out why this won't run.
3
0
1.6k
Oct ’21
Redirect stdout not working on iOS 15
I create a tool XLLoger, that can redirect stdout to the textView, It works well on iOS14 and below, but on iOS15, when the app running on Xcode connecting the device or simulator, the code can get the logs, if disconnected xcode, the app can't get print log, the NSLog can be get. I changed a variety of methods to redirect logs, all of which are the same phenomenon. Anything wrong with my code?
0
0
717
Sep ’21
Question about sharing data via Cloudkit and Core Data - Creating CKShare
I am trying to use the new API provided by WWDC21 to create Core Data databases that can be shared. When I do the sharing for an NSManageObject, I tried to experiment with 2 methods. 1: Using UICloudSharingController's UICloudSharingController(preparationHandler: (UICloudSharingController, @escaping (CKShare?, CKContainer?, Error?) -> Void) -> Void) method. Currently this method works and the participants can get all the data after accepting the invitation. 2:Use NSPersistentContainer's share(_ managedObjects: [NSManagedObject], to share: CKShare?) async throws -> (Set<NSManagedObjectID>, CKShare, CKContainer) method. First get ckshare, then call UICloudSharingController(share:, container: ) With this approach, after accepting the invitation, the participant only gets the data generated after the creation of the ckshare, and the data before the ckshare is never fetched I'm not sure if it's an error in the token generated by the share method of the NSPersistentContainer or something else. Has anyone encountered a similar situation?
1
0
1.3k
Sep ’21
App crashing while using collection view
I was trying to have a secondary collection view with circle images above (y axis) the functioning collection view but its crashing and throwing this error Error code: could not dequeue a view of kind: UICollectionElementKindCell with identifier CircleCollectionViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard ViewController code: // //  ViewController.swift //  Main_app // //  Created by Kushagr Agarwal on 23/08/21. // import UIKit class ViewController: UIViewController {     @IBOutlet var collectionView: UICollectionView!          @IBOutlet var topCollectionView: UICollectionView!          @IBOutlet weak var Leading: NSLayoutConstraint!          @IBOutlet weak var Trailing: NSLayoutConstraint!          @IBOutlet private weak var Menubutton: UIButton!     var menuOut = false               override func viewDidLoad() {         super.viewDidLoad()         // Do any additional setup after loading the view.         //self.navigationItem.titleView = UIImageView(image: UIImage(named: "Logo"))                  collectionView.register(MiddleCollectionViewCell.nib(), forCellWithReuseIdentifier: MiddleCollectionViewCell.identifier)                  collectionView.delegate=self         collectionView.dataSource=self                  topCollectionView.register(CircleCollectionViewCell.self, forCellWithReuseIdentifier: CircleCollectionViewCell.identifier)         topCollectionView.delegate=self         topCollectionView.dataSource=self //       Menu //       start                  let destructiveAction = UIAction(title: "Delete",image: UIImage(systemName: "nosign") , attributes: .destructive) { (_) in             print("Delete")         }                  let menu = UIMenu(title: "", children: [             UIAction (title: "Add New", image: UIImage(systemName: "plus.circle"), handler: { _ in  }),             UIAction (title: "Manage", image: UIImage(systemName: "hammer"), handler: { _ in  }),             destructiveAction         ])         self.Menubutton.menu = menu //    Menu end     } // Menu animation     @IBAction func MenuTap(_ sender: Any) {         if menuOut == false {             Leading.constant = -150             Trailing.constant = 150             menuOut = true         }         else{             Leading.constant = 0             Trailing.constant = 0             menuOut = false         }         UIView.animate(withDuration: 0.2, delay: 0.0 , options: .curveEaseIn,animations: {             self.view.layoutIfNeeded()         }){(animationComplete) in             print("Animation Completed")         }     } // Menu animation ends } // used for upper collection view extension ViewController: UICollectionViewDelegate {          func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {         collectionView.deselectItem(at: indexPath, animated: true )         print("btn tapped")              }           } extension ViewController: UICollectionViewDataSource {     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {         return 12     }     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MiddleCollectionViewCell.identifier, for: indexPath) as! MiddleCollectionViewCell         let topcell = collectionView.dequeueReusableCell(withReuseIdentifier: CircleCollectionViewCell.identifier, for: indexPath) as! CircleCollectionViewCell         topcell.configure(with: "")                  cell.configure(with: UIImage(named: "four")!)         return cell; topcell     } } //extension ViewController: UICollectionViewDelegateFlowLayout { // //}
1
0
2.1k
Sep ’21
Gambling and Gaming Beta Test
We will soon be launching a gambling/gaming beta test in Virginia that will be IOS friendly. Although we do not yet have a license, we wont be integrating real money in the beta test. The currency in the beta test will only be play money that we will be using to prove the concept of our platform. Subsequently when that concept is proven, we will then get a license to incorporate real money and have third party payment processors. Judging from this synopsis, will we have any trouble getting approved by the apple app store?
0
0
746
Aug ’21
Core Data Error
When I add a picture in a shared item from a device other than the owner I am getting an error in the console as follows: CoreData: Unable to provide a default CKRecordZoneID for database scope: Shared. Please note that I am using the sample project from the WWDC video titled Build apps that share data through CloudKit and Core Data. How might I be able to fix this error and what might be causing it?
0
0
671
Jul ’21
Add NSManagedObject to existing CKShare
Using NSPersistentCloudKitContainer, how do I add (or modify) the NSManageObjects that are part of a Share/Zone? I have initially created a CKShare using NSPersistentCloudKitContainer.share(_:to:completion:), how can I add objects to that share later on? Calling the method again (with to:existingShare filed), always seems to create a new Share. In fact, I don't understand what the to: parameter is for? It doesn't matter if I set it or not, a new CKShare is always created.
3
0
1.1k
Jul ’21
Share data through CloudKit and Core Data with macOS
I'm trying to replicate the behavior of the iOS sample application provided by Apple in order to share my Core Data objects through CloudKit. I am able to share CKRecords through Mail and Airdrop by obtaining the URL, but I cannot be able to get the iCloud Share modal window. let sharingService = NSSharingService(named: .cloudSharing) sharingService?.delegate = self coredataContainer.share([ManagedObjectToShare], to: nil, completion: { [weak self] objectIDs, shareCK, container, error in if let error = error {  fatalError(error.localizedDescription) } else { self?.sharingService?.perform(withItems: [shareCK?.url]) } }) If I substitute the .cloudSharing for .composeEmail, the modal window opens correctly and provides me an URL to access to the object, but nothing happens when .cloudSharingis seated as SharingService. How can I accomplish this?
0
0
814
Jun ’21
Provisioning issue with CoreDataCloudKitDemo
I've been struggling to get the CoreDataCloudKitDemo working. I've updated to Xcode 13 and followed the documented instructions closely. However, I'm getting this error: Provisioning profile "Mac Team Provisioning Profile: com.____.apple-samplecode.CoreDataCloudKitDemo" doesn't include the aps-environment entitlement. A bit of searching says this error is due to Push Notifications not being enabled. However, I do have them enabled. I cannot figure out why this won't run.
Replies
3
Boosts
0
Views
1.6k
Activity
Oct ’21
Redirect stdout not working on iOS 15
I create a tool XLLoger, that can redirect stdout to the textView, It works well on iOS14 and below, but on iOS15, when the app running on Xcode connecting the device or simulator, the code can get the logs, if disconnected xcode, the app can't get print log, the NSLog can be get. I changed a variety of methods to redirect logs, all of which are the same phenomenon. Anything wrong with my code?
Replies
0
Boosts
0
Views
717
Activity
Sep ’21
Question about sharing data via Cloudkit and Core Data - Creating CKShare
I am trying to use the new API provided by WWDC21 to create Core Data databases that can be shared. When I do the sharing for an NSManageObject, I tried to experiment with 2 methods. 1: Using UICloudSharingController's UICloudSharingController(preparationHandler: (UICloudSharingController, @escaping (CKShare?, CKContainer?, Error?) -> Void) -> Void) method. Currently this method works and the participants can get all the data after accepting the invitation. 2:Use NSPersistentContainer's share(_ managedObjects: [NSManagedObject], to share: CKShare?) async throws -> (Set<NSManagedObjectID>, CKShare, CKContainer) method. First get ckshare, then call UICloudSharingController(share:, container: ) With this approach, after accepting the invitation, the participant only gets the data generated after the creation of the ckshare, and the data before the ckshare is never fetched I'm not sure if it's an error in the token generated by the share method of the NSPersistentContainer or something else. Has anyone encountered a similar situation?
Replies
1
Boosts
0
Views
1.3k
Activity
Sep ’21
App crashing while using collection view
I was trying to have a secondary collection view with circle images above (y axis) the functioning collection view but its crashing and throwing this error Error code: could not dequeue a view of kind: UICollectionElementKindCell with identifier CircleCollectionViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard ViewController code: // //  ViewController.swift //  Main_app // //  Created by Kushagr Agarwal on 23/08/21. // import UIKit class ViewController: UIViewController {     @IBOutlet var collectionView: UICollectionView!          @IBOutlet var topCollectionView: UICollectionView!          @IBOutlet weak var Leading: NSLayoutConstraint!          @IBOutlet weak var Trailing: NSLayoutConstraint!          @IBOutlet private weak var Menubutton: UIButton!     var menuOut = false               override func viewDidLoad() {         super.viewDidLoad()         // Do any additional setup after loading the view.         //self.navigationItem.titleView = UIImageView(image: UIImage(named: "Logo"))                  collectionView.register(MiddleCollectionViewCell.nib(), forCellWithReuseIdentifier: MiddleCollectionViewCell.identifier)                  collectionView.delegate=self         collectionView.dataSource=self                  topCollectionView.register(CircleCollectionViewCell.self, forCellWithReuseIdentifier: CircleCollectionViewCell.identifier)         topCollectionView.delegate=self         topCollectionView.dataSource=self //       Menu //       start                  let destructiveAction = UIAction(title: "Delete",image: UIImage(systemName: "nosign") , attributes: .destructive) { (_) in             print("Delete")         }                  let menu = UIMenu(title: "", children: [             UIAction (title: "Add New", image: UIImage(systemName: "plus.circle"), handler: { _ in  }),             UIAction (title: "Manage", image: UIImage(systemName: "hammer"), handler: { _ in  }),             destructiveAction         ])         self.Menubutton.menu = menu //    Menu end     } // Menu animation     @IBAction func MenuTap(_ sender: Any) {         if menuOut == false {             Leading.constant = -150             Trailing.constant = 150             menuOut = true         }         else{             Leading.constant = 0             Trailing.constant = 0             menuOut = false         }         UIView.animate(withDuration: 0.2, delay: 0.0 , options: .curveEaseIn,animations: {             self.view.layoutIfNeeded()         }){(animationComplete) in             print("Animation Completed")         }     } // Menu animation ends } // used for upper collection view extension ViewController: UICollectionViewDelegate {          func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {         collectionView.deselectItem(at: indexPath, animated: true )         print("btn tapped")              }           } extension ViewController: UICollectionViewDataSource {     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {         return 12     }     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MiddleCollectionViewCell.identifier, for: indexPath) as! MiddleCollectionViewCell         let topcell = collectionView.dequeueReusableCell(withReuseIdentifier: CircleCollectionViewCell.identifier, for: indexPath) as! CircleCollectionViewCell         topcell.configure(with: "")                  cell.configure(with: UIImage(named: "four")!)         return cell; topcell     } } //extension ViewController: UICollectionViewDelegateFlowLayout { // //}
Replies
1
Boosts
0
Views
2.1k
Activity
Sep ’21
Are there and SwiftUI examples for Core Data/Cloudkit Sharing
In the WWDC2021 talk on building apps that share data through CloudKit and Core Data there seems to be a lack of examples that use SwiftUI. Is there any place o find such examples or even a tutorial?
Replies
2
Boosts
0
Views
1.2k
Activity
Aug ’21
mailto break line show <BR>
mailto break line %0D%0A show
Replies
0
Boosts
0
Views
504
Activity
Aug ’21
Gambling and Gaming Beta Test
We will soon be launching a gambling/gaming beta test in Virginia that will be IOS friendly. Although we do not yet have a license, we wont be integrating real money in the beta test. The currency in the beta test will only be play money that we will be using to prove the concept of our platform. Subsequently when that concept is proven, we will then get a license to incorporate real money and have third party payment processors. Judging from this synopsis, will we have any trouble getting approved by the apple app store?
Replies
0
Boosts
0
Views
746
Activity
Aug ’21
Build apps that share data through CloudKit and Core Data Demo Code
I have been waiting for this for many years. Thank you. Is there demo code that accompanies this video?
Replies
1
Boosts
0
Views
1.1k
Activity
Jul ’21
Core Data Error
When I add a picture in a shared item from a device other than the owner I am getting an error in the console as follows: CoreData: Unable to provide a default CKRecordZoneID for database scope: Shared. Please note that I am using the sample project from the WWDC video titled Build apps that share data through CloudKit and Core Data. How might I be able to fix this error and what might be causing it?
Replies
0
Boosts
0
Views
671
Activity
Jul ’21
NSPersistentStore where get?
container.acceptShareInvitations(from: [cloudKitShareMetadata], into: NSPersistentStore) how to get NSPersistentStore?
Replies
0
Boosts
0
Views
526
Activity
Jul ’21
photo verification
are there any iOS plugins or third party plugins that do photo verification in app? appreciate it
Replies
0
Boosts
0
Views
442
Activity
Jul ’21
Add NSManagedObject to existing CKShare
Using NSPersistentCloudKitContainer, how do I add (or modify) the NSManageObjects that are part of a Share/Zone? I have initially created a CKShare using NSPersistentCloudKitContainer.share(_:to:completion:), how can I add objects to that share later on? Calling the method again (with to:existingShare filed), always seems to create a new Share. In fact, I don't understand what the to: parameter is for? It doesn't matter if I set it or not, a new CKShare is always created.
Replies
3
Boosts
0
Views
1.1k
Activity
Jul ’21
ios 14 for developers
Can I still see if a user downloads my app if they choose to opt-out of app tracking?
Replies
0
Boosts
0
Views
598
Activity
Jul ’21
Share data through CloudKit and Core Data with macOS
I'm trying to replicate the behavior of the iOS sample application provided by Apple in order to share my Core Data objects through CloudKit. I am able to share CKRecords through Mail and Airdrop by obtaining the URL, but I cannot be able to get the iCloud Share modal window. let sharingService = NSSharingService(named: .cloudSharing) sharingService?.delegate = self coredataContainer.share([ManagedObjectToShare], to: nil, completion: { [weak self] objectIDs, shareCK, container, error in if let error = error {  fatalError(error.localizedDescription) } else { self?.sharingService?.perform(withItems: [shareCK?.url]) } }) If I substitute the .cloudSharing for .composeEmail, the modal window opens correctly and provides me an URL to access to the object, but nothing happens when .cloudSharingis seated as SharingService. How can I accomplish this?
Replies
0
Boosts
0
Views
814
Activity
Jun ’21