Posts

Post marked as solved
1 Replies
405 Views
I am trying to set contraints for MKMapView but whenever I control click I get the outlets menu instead! Works for labels and all else, but not for the map.
Posted
by leo008.
Last updated
.
Post marked as solved
4 Replies
609 Views
I have a standard UITableViewController and I have added an MKMapKit map neatly on the top half of the screen (and the table in the bottom half). During runtime, if we scroll through the table records, the map scrolls up as well. What I wanted to do was have the map static, not scrolling, while I scroll the table. Any ideas on how to accomplish this, please?
Posted
by leo008.
Last updated
.
Post marked as solved
1 Replies
719 Views
I am filtering records from cloudkit based on the user's location. When he moves, CKRecord gets updated and so does UITableView. So far all perfect. The issue is when the user moves to an area where there are no records and the CKRecord returns nil. When this happens, instead of UITableView displaying nothing, it actually shows the last records that were available before nil. I would like the table to show something like "No records" or at least nothing at all. Any ideas?
Posted
by leo008.
Last updated
.
Post marked as solved
3 Replies
532 Views
Can someone help me identify what is wrong with my predicate string, please? query = CKQuery(recordType: RecordType, predicate: NSPredicate(format: "(Lat > "+String(currentPlaceLat - limit)+") AND (Lat < "+String(currentPlaceLat + limit)+") AND (Long > "+String(currentPlaceLong - limit)+") AND (Long < "+String(currentPlaceLong + limit)+")") This is what it prints during runtime: (Lat > 39.872) AND (Lat < 49.872) AND (Long > -85.493) AND (Long < -75.493) I want to filter out the records that are between that latitude and that longitude, but Im sure there is something wrong with my query. Sorry, I am new to CloudKit.
Posted
by leo008.
Last updated
.
Post marked as solved
1 Replies
484 Views
Getting BAD_REQUEST on the CloudKit log when the app tries to save data: CKContainer(identifier: "iCloud.XXXX").publicCloudDatabase.save Any ideas, please?
Posted
by leo008.
Last updated
.
Post marked as solved
1 Replies
628 Views
Not sure what I am doing wrong here, but my "record" variable keeps returning "nil". When I run the savetoCloud() function, it crashes because record is "nil" (when it should have the data to be uploaded to CloudKit instead). Help please. I have this in a .swift file: import Foundation import CloudKit public class dbData: NSObject{ var record: CKRecord? var lightDB: Bool?{ didSet{ record!["Light"] = lightDB } } init(record: CKRecord){ self.record = record self.lightDB = self.record!["Light"] as? Bool } convenience init(light: Bool) { self.init(record: CKRecord(recordType: "Location", recordID: CKRecord.ID(recordName: UUID().uuidString))) self.lightDB = light } } And then this on the main View Controller: import UIKit import CloudKit class MapViewController: UIViewController { let publicDatabase = CKContainer(identifier: "iCloud.XXXX").database(with: .public) var dbdata: dbData? @IBOutlet weak var lightSW: UISwitch! override func viewDidLoad() { super.viewDidLoad() public func savetoCloud(){ let light = lightSW.isOn let record = self.dbdata?.record record!["Light"] = light self.dbdata?.record = record publicDatabase.save(record!) { (record, error) in if let error = error{ print("Error\(error.localizedDescription)") return } print("Record saved: \(record?.recordID.recordName ?? "")") } }
Posted
by leo008.
Last updated
.
Post marked as solved
3 Replies
1.9k Views
Having trouble using CloudKit. I used this code: let publicDatabase = CKContainer(identifier: "iCloud.***.XXXX").database(with: .public) With the correct container instead of "XX" and enabled these capabilities: Background modes: remote notifications enabled iCloud: CloudKit enabled Note this is not the default container - I had to create a new one because the default one is loading incorrectly in the dashboard - "Error loading container details.").  App is not recording records to public iCloud database. Please help, I am new to Swift and Xcode. Here is some debugging (edited to make it shorter): 0..> test_useLegacySavePolicy:YES archivingUtilities:<PFCloudKitArchivingUtilities: 0x..0> storeOptions: { NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; NSPersistentCloudKitContainerOptionsKey = "<NSPersistentCloudKitContainerOptions: 0x2..30>"; NSPersistentHistoryTrackingKey = 1; NSPersistentStoreMirroringOptionsKey = { NSPersistentStoreMirroringDelegateOptionKey = "<NSCloudKitMirroringDelegate: 0x2...c0>"; }; } CoreData: debug: CoreData+CloudKit: <NSCloudKitMirroringDelegate: 0x2...>: Observing store: <NSSQLCore: 0x1...0> CoreData: CloudKit: CoreData+CloudKit: ...<NSCloudKitMirroringDelegate: 0x2....c0>: Successfully enqueued setup request. CoreData: CloudKit: CoreData+CloudKit: ....<NSCloudKitMirroringDelegate: 0x2...0>: Checking for pending requests. CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest]_block_invoke(2941): <NSCloudKitMirroringDelegate: 0x....6c0>: Executing: <NSCloudKitMirroringDelegateSetupRequest: 0x...7a80> 2022-04-19 11:10:09..00 [Snapshotting] Snapshotting a view (0x10600e400, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES. CoreData: debug: CoreData+CloudKit: ...Skipping migration for 'ANSCKDATABASEMETADATA' because it already has a column named 'ZLASTFETCHDATE' ... CoreData: CloudKit: CoreData+CloudKit: -[PFCloudKitSetupAssistant _checkUserIdentity:]_block_invoke(1235): <PFCloudKitSetupAssistant: 0x28...>: CKIdentity record matches store: <CKRecordID: 0x280...; recordName=_17385bb3..., zoneID=_defaultZone:defaultOwner> 2022-04-19 11:10:10.130670-0400 error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(1106): <NSCloudKitMirroringDelegate: 0x2833256c0>: Failed to set up CloudKit integration for store: <NSSQLCore: 0x104....610> <CKError 0x2807902a0: "Partial Failure" (2/1011); "Failed to modify some record zones"; uuid = E88D-A....3D7-B4; container ID = "iCloud.XXXX"; partial errors: { com.apple.coredata.cloudkit.zone:defaultOwner = <CKError 0x280797a80: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; op = 5F3....3571; uuid = E8810E9D-23....3D7-C9....8A7...B4> }>
Posted
by leo008.
Last updated
.