Post

Replies

Boosts

Views

Activity

Reply to Contacts Framework CNFetchResult
I finally came back to this question. Again, I'm trying to duplicate the Objective-C code on this post on stackoverflow to Swift. Here's the Objective-C code from the post: CNChangeHistoryFetchRequest *fetchHistory = [[CNChangeHistoryFetchRequest alloc] init]; fetchHistory.startingToken = [[NSUserDefaults standardUserDefaults] dataForKey:@"CNContactChangeHistoryToken"]; NSError *error = nil; CNContactStore *store = [[CNContactStore alloc] init]; CNFetchResult *fetchResult = [store enumeratorForChangeHistoryFetchRequest:fetchHistory error:&error]; NSEnumerator *enumerator = [fetchResult value]; id object; while ((object = [enumerator nextObject])) {     // do something with object     NSLog(@"change history enumerator object = %@", object);     CNChangeHistoryEvent *historyEvent = (CNChangeHistoryEvent *) object;     if ([historyEvent isKindOfClass:[CNChangeHistoryDropEverythingEvent class]]) {         NSLog(@"change history - DROP EVERYTHING!");         [historyEvent acceptEventVisitor: self];     } else {         if ([historyEvent isKindOfClass:[CNChangeHistoryAddContactEvent class]]) {             CNChangeHistoryAddContactEvent *addContactEvent = (CNChangeHistoryAddContactEvent *) object;             NSLog(@"change history - AddContact event container %@ - %@", addContactEvent.containerIdentifier, addContactEvent.contact);         } else if ([historyEvent isKindOfClass:[CNChangeHistoryUpdateContactEvent class]]) {             CNChangeHistoryUpdateContactEvent *updateContactEvent = (CNChangeHistoryUpdateContactEvent *) object;             NSLog(@"change history - UpdateContact event - %@", updateContactEvent.contact);         } else if ([historyEvent isKindOfClass:[CNChangeHistoryDeleteContactEvent class]]) {             CNChangeHistoryDeleteContactEvent *deleteContactEvent = (CNChangeHistoryDeleteContactEvent *) object;             NSLog(@"change history - DeleteContact event - %@", deleteContactEvent.contactIdentifier);         }     } } Here's my Swift code, as far as I got: public func tryChangeHistoryFetchRequest() {          let fetchHistory = CNChangeHistoryFetchRequest()          let store = CNContactStore()          print("*****")          let fetchResult: CNFetchResult<NSEnumerator<CNChangeHistoryEvent>> = fetchHistory          } // Enumerate through each visit function and check if I get anything back from fetch request. class ChangeHistoryEventVisitor: NSEnumerator, CNChangeHistoryEventVisitor {     override func nextObject() -> Any? {                  let changeHistoryDropEverythingEvent = CNChangeHistoryDropEverythingEvent()                  return {}              }          func visit(_ event: CNChangeHistoryDropEverythingEvent) {                  print("CNChangeHistoryDropEverythingEvent")              }     func visit(_ event: CNChangeHistoryAddContactEvent) {              }     func visit(_ event: CNChangeHistoryUpdateContactEvent) {              }     func visit(_ event: CNChangeHistoryDeleteContactEvent) {              } } public func tryChangeHistoryEventVisitor() {          print("*****")          let changeHistoryEventVisitor = ChangeHistoryEventVisitor()     print("*****")          let changeHistoryDropEverythingEvent = CNChangeHistoryDropEverythingEvent()          changeHistoryEventVisitor.visit(changeHistoryDropEverythingEvent) } class ChangeHistoryAddContactEvent: CNChangeHistoryAddContactEvent {      } class CNChangeHistoryFetchResult: CNFetchResult<NSEnumerator<CNChangeHistoryEvent>> {      }
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’22
Reply to Deleting/Leaving a share
Did you ever figure this out? I want to know how to delete a share programmatically in iOS using Xcode with Swift. I need to use it as a programmer, not for the iOS app to allow the user to delete a share. I don't believe there is any other way to delete a share than with code. It doesn't look like CloudKit Dashboard allows me to delete all records in a database. The dashboard does not allow querying cloudkit.share.
Apr ’22
Reply to Blank project page in Xcode
There was a button that enables and disables code preview. It's on the very top right-hand corner below the "+" button and the button to hide and show Inspectors in the right-hand side of the Xcode screen. When the code preview is enabled, then when I click the project in Project navigator the Editor window is blank. I think that's called the Editor window.
Apr ’22
Reply to Why does UICloudSharingController ask to add participants when I choose to let anyone with the link have access?
I have since tested the link when I select "Anyone with the link" for "WHO CAN ACCESS". Only Apple IDs that are added by the owner can get access to the share. When I test the URL on another using a different Apple ID than the device that shared the share, I get a message saying that either the owner stopped sharing or I doesn't have permission.
May ’22
Reply to Deleting/Leaving a share
I found the following at Developer->Documentation->CloudKit->Shared Records. This must be Apple's prescribed method. To stop sharing, the share’s owner must delete the share or, for shared hierarchies, the root record. If a participant wants to leave the share, delete the share record from their shared database. Use UICloudSharingController or NSSharingService to allow a participant to stop participating. Or remove them from the share using the removeParticipant(_:) method, and then save the updated share to iCloud.
May ’22
Reply to What word means to make something true if it is at first false?
The best I've come up with is "assure", "insure", and especially "constraint". "Force" is a good one too. I settled with . . . checkAndResave(_:completionHandler:) I was looking for a really accurate word to name a function that checks to see if a certain datum has been saved in a data store, then if it hasn't then I save it. So the word I'm looking for needs to reflect that I make sure it's there. Maybe "verify", but that still doesn't convey that I save the data if it's not there, just to check to be sure that it is there with the expectation that it is there. I take the presumption that I don't know whether it's there or not. That's fine. I'll settle with "checkAndResave". Thank you everyone. Maybe a word will pop up in the middle of the night while I'm half asleep.
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’22
Reply to [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:963
I should add that this error occurs only when I'm debugging with Xcode using a device rather than a simulator. When I use a device, I use CKSubscriptions on the sharedCloudDatabase, but not when I use a simulator. The error seems to occur right after I create a share using UICloudSharingController. The error message appear in the debug window right after print commands in the func cloudSharingControllerDidSaveShare(_ csc: UICloudSharingController) of UICloudSharingControllerDelegate.
Jun ’22
Reply to Contacts Framework CNFetchResult
I finally came back to this question. Again, I'm trying to duplicate the Objective-C code on this post on stackoverflow to Swift. Here's the Objective-C code from the post: CNChangeHistoryFetchRequest *fetchHistory = [[CNChangeHistoryFetchRequest alloc] init]; fetchHistory.startingToken = [[NSUserDefaults standardUserDefaults] dataForKey:@"CNContactChangeHistoryToken"]; NSError *error = nil; CNContactStore *store = [[CNContactStore alloc] init]; CNFetchResult *fetchResult = [store enumeratorForChangeHistoryFetchRequest:fetchHistory error:&error]; NSEnumerator *enumerator = [fetchResult value]; id object; while ((object = [enumerator nextObject])) {     // do something with object     NSLog(@"change history enumerator object = %@", object);     CNChangeHistoryEvent *historyEvent = (CNChangeHistoryEvent *) object;     if ([historyEvent isKindOfClass:[CNChangeHistoryDropEverythingEvent class]]) {         NSLog(@"change history - DROP EVERYTHING!");         [historyEvent acceptEventVisitor: self];     } else {         if ([historyEvent isKindOfClass:[CNChangeHistoryAddContactEvent class]]) {             CNChangeHistoryAddContactEvent *addContactEvent = (CNChangeHistoryAddContactEvent *) object;             NSLog(@"change history - AddContact event container %@ - %@", addContactEvent.containerIdentifier, addContactEvent.contact);         } else if ([historyEvent isKindOfClass:[CNChangeHistoryUpdateContactEvent class]]) {             CNChangeHistoryUpdateContactEvent *updateContactEvent = (CNChangeHistoryUpdateContactEvent *) object;             NSLog(@"change history - UpdateContact event - %@", updateContactEvent.contact);         } else if ([historyEvent isKindOfClass:[CNChangeHistoryDeleteContactEvent class]]) {             CNChangeHistoryDeleteContactEvent *deleteContactEvent = (CNChangeHistoryDeleteContactEvent *) object;             NSLog(@"change history - DeleteContact event - %@", deleteContactEvent.contactIdentifier);         }     } } Here's my Swift code, as far as I got: public func tryChangeHistoryFetchRequest() {          let fetchHistory = CNChangeHistoryFetchRequest()          let store = CNContactStore()          print("*****")          let fetchResult: CNFetchResult<NSEnumerator<CNChangeHistoryEvent>> = fetchHistory          } // Enumerate through each visit function and check if I get anything back from fetch request. class ChangeHistoryEventVisitor: NSEnumerator, CNChangeHistoryEventVisitor {     override func nextObject() -> Any? {                  let changeHistoryDropEverythingEvent = CNChangeHistoryDropEverythingEvent()                  return {}              }          func visit(_ event: CNChangeHistoryDropEverythingEvent) {                  print("CNChangeHistoryDropEverythingEvent")              }     func visit(_ event: CNChangeHistoryAddContactEvent) {              }     func visit(_ event: CNChangeHistoryUpdateContactEvent) {              }     func visit(_ event: CNChangeHistoryDeleteContactEvent) {              } } public func tryChangeHistoryEventVisitor() {          print("*****")          let changeHistoryEventVisitor = ChangeHistoryEventVisitor()     print("*****")          let changeHistoryDropEverythingEvent = CNChangeHistoryDropEverythingEvent()          changeHistoryEventVisitor.visit(changeHistoryDropEverythingEvent) } class ChangeHistoryAddContactEvent: CNChangeHistoryAddContactEvent {      } class CNChangeHistoryFetchResult: CNFetchResult<NSEnumerator<CNChangeHistoryEvent>> {      }
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Location permissions - always allow
Have you figured this out? I believe this can be done. I have an app from Intuit that always tracks me. My iPhone at times tells me that app is tracking my location and asks me if I want to turn that always tracking feature off.
Replies
Boosts
Views
Activity
Mar ’22
Reply to Location permission message for Always Usage
Have you figured out how to make your app track the device even when your app is not running, even after the iOS device is shut off and then turned off again.
Replies
Boosts
Views
Activity
Mar ’22
Reply to UICloudSharingController is broken and needs Apple's attention
Is it possible to subclass UICloudSharingController?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Deleting/Leaving a share
Did you ever figure this out? I want to know how to delete a share programmatically in iOS using Xcode with Swift. I need to use it as a programmer, not for the iOS app to allow the user to delete a share. I don't believe there is any other way to delete a share than with code. It doesn't look like CloudKit Dashboard allows me to delete all records in a database. The dashboard does not allow querying cloudkit.share.
Replies
Boosts
Views
Activity
Apr ’22
Reply to Blank project page in Xcode
There was a button that enables and disables code preview. It's on the very top right-hand corner below the "+" button and the button to hide and show Inspectors in the right-hand side of the Xcode screen. When the code preview is enabled, then when I click the project in Project navigator the Editor window is blank. I think that's called the Editor window.
Replies
Boosts
Views
Activity
Apr ’22
Reply to Why does UICloudSharingController ask to add participants when I choose to let anyone with the link have access?
I have since tested the link when I select "Anyone with the link" for "WHO CAN ACCESS". Only Apple IDs that are added by the owner can get access to the share. When I test the URL on another using a different Apple ID than the device that shared the share, I get a message saying that either the owner stopped sharing or I doesn't have permission.
Replies
Boosts
Views
Activity
May ’22
Reply to Deleting/Leaving a share
I found the following at Developer->Documentation->CloudKit->Shared Records. This must be Apple's prescribed method. To stop sharing, the share’s owner must delete the share or, for shared hierarchies, the root record. If a participant wants to leave the share, delete the share record from their shared database. Use UICloudSharingController or NSSharingService to allow a participant to stop participating. Or remove them from the share using the removeParticipant(_:) method, and then save the updated share to iCloud.
Replies
Boosts
Views
Activity
May ’22
Reply to What word means to make something true if it is at first false?
The best I've come up with is "assure", "insure", and especially "constraint". "Force" is a good one too. I settled with . . . checkAndResave(_:completionHandler:) I was looking for a really accurate word to name a function that checks to see if a certain datum has been saved in a data store, then if it hasn't then I save it. So the word I'm looking for needs to reflect that I make sure it's there. Maybe "verify", but that still doesn't convey that I save the data if it's not there, just to check to be sure that it is there with the expectation that it is there. I take the presumption that I don't know whether it's there or not. That's fine. I'll settle with "checkAndResave". Thank you everyone. Maybe a word will pop up in the middle of the night while I'm half asleep.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How do I update CloudKit whenever there is a change in Contacts in iOS?
What about using iCloud. Is there a way for my app to be able to know when iCloud is currently syncing? If my app sees that iCloud is currently syncing, it can run code to check the Contacts that CloudKit have records of. Is there a way to tell if there are Contacts that are syncing and which contacts are syncing?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to What is the new "Background Processing" Background Mode?
I want to know if there is a way to run a process even when my app isn't running. Is that possible?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Continuous Background Processing on Catalyst
Hi. I need to use continuous background process to receive notifications whenever there is a change in contact store. Have you found any way to continuously watch when something changes even when the app is not running -- I mean the app that needs to know when there are any changes?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Scheduled, background process
I think there is a way now to schedule background processes.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How do I update CloudKit whenever there is a change in Contacts in iOS?
The best thing so far that I have found is found in this article Choosing Background Strategies for Your App under the heading Update Your App's Content. If anyone knows of a better way, I'd really like to know.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:963
I should add that this error occurs only when I'm debugging with Xcode using a device rather than a simulator. When I use a device, I use CKSubscriptions on the sharedCloudDatabase, but not when I use a simulator. The error seems to occur right after I create a share using UICloudSharingController. The error message appear in the debug window right after print commands in the func cloudSharingControllerDidSaveShare(_ csc: UICloudSharingController) of UICloudSharingControllerDelegate.
Replies
Boosts
Views
Activity
Jun ’22