Post

Replies

Boosts

Views

Activity

How does my app know when iOS calls completionHandler of completeRequest(returningItems:completionHandler:)?
In this documentation for completeRequest(returningItems:completionHandler:), there is a box shaded yellow that says: Important If the system calls your block with an expired value of true, you must immediately suspend your app extension. If you fail to do this, the system terminates your extension’s process. How does my app or my Share Extension know when the system calls the block spoken of?
2
0
741
Jul ’22
How does let statement work?
If I have a class property let appDelegate: AppDelegate? = UIApplication.shared.delegate as? AppDelegate Each time appDelegate is accessed, would it return the value at the time it is accessed, or would it return the value the first time it was accessed? I'm trying to understand whether the property above works the same way as let appDelegate: AppDelegate? = { return UIApplication.shared.delegate as? AppDelegate }() The second declaration of the appDelegate property runs the closure the first time the property is accessed and never again. Later references to appDelegate returns the value that was returned the first time the property was accessed.
1
0
505
Aug ’22
What files used by Xcode can I delete?
I ran out of disk space and I think I've come to the point that I need to delete files used by Xcode. Can I delete Simulator altogether? It doesn't look like I can run the latest Xcode without iOS 18 installed with it on my Mac Pro. Is there any way I can exclude iOS 18 support using the current Xcode? Would it be a good option to uninstall the latest Xcode and use a previous version of Xcode instead, since I'm not developing for iOS 18? Since I've been working on only macOS apps, is it possible for me to delete anything that has to do with developing for iOS?
1
0
638
Nov ’24
What happens when I delete an App ID in my developer account?
I clicked the delete button to an App ID in my developer account and I got a message saying "All certificates associated with the App ID will be deleted and any provisioning profiles associated with this App ID will be invalidated." Why would the entire provisioning profile be invalidated? What about the other App IDs in that provisioning profile? Does that mean I wouldn't be able to use the provisioning profile for those other App IDs at all?
2
0
3.3k
Feb ’21
Why does ShapeEdit use FileManager copyItem instead of setUbiquitous?
I have a question about code in the ShapeEdit sample from Apple.I their code, as shown below, why did they use FileManager's copyItem method instead of its setUbiquitous method? Didn't the documentation say explicitly to use setUbiquitous method? NSFileCoordinator().coordinate(with: [readIntent, writeIntent], queue: self.coordinationQueue) { error in if error != nil { return } do { try fileManager.copyItem(at: readIntent.url, to: writeIntent.url) try (writeIntent.url as NSURL).setResourceValue(true, forKey: URLResourceKey.hasHiddenExtensionKey) OperationQueue.main.addOperation { self.openDocumentAtURL(writeIntent.url) } } catch { fatalError("Unexpected error during trivial file operations: \(error)") } }
1
0
937
Jan ’21
Contacts Framework CNFetchResult
Anyone ever use CNFetchResult successfully? I find nothing on the internet, on stackoverflow, and in Apple Developer Forums. The only thing I have found is Apple Documentation for it. It says CNFetchResult is a Generic Class. What exactly does that mean. I found an explanation that gives its definition, but the rest of the explanation is very long winded.
10
0
1.5k
Mar ’22
How do I set the default contacts container for my iOS app to the contacts container that is saved in iCloud?
I am writing an iOS app using Swift and Xcode 13.1. I am using the Contacts Framework, and I read that each app has a default contacts container, and the default container in an app can be different than the default container in another app, and there is not a default container for the entire device. What determines which is the default container for the app made by an Xcode project? I didn't set the default container for my app and somehow the contacts container for a Google account became the default contacts container for my app. How do I use code to set the default contacts container for my app? How do I find out which is the default container of Apple's Contacts app that comes with iOS? I would like to set my app's default contacts container to the same default container of Apple's Contacts app, if that is the contacts container that is saved on iCloud. If not, I would like to set my app's default contacts container to the contacts container that is saved in iCloud. I assume that only one contacts container is saved on iCloud.
0
0
547
Dec ’21
How do I write code to run when the contact store was changed by another app, but not run when the contact store was changed by my app?
I noticed that when my app changes the contact store, the CNContactStoreDidChange notification fires in my app. How do I check if the notification fired because my app changed it. Is there a way to know which app made the change to the contact store. I need to know so I can write code to run only if the contact store was changed by another app instead of my app.
1
0
712
Dec ’21
iOS Contacts Framework Change History Data using Swift and Xcode 13
On Apple's documentation of the Contacts Framework for iOS and Swift on their developer website, there is a section called Change History Data. It consists of a list of classes and one protocol. The protocol seems to be the most important item of the list - the CNChangeHistoryEventVisitor protocol. The protocol apparently has instance methods each of which use one of those classes listed. Where do I find documentation to use this protocol and these classes? Anyone ever use these before? Here's the list: class CNChangeHistoryAddContactEvent class CNChangeHistoryAddGroupEvent class CNChangeHistoryAddMemberToGroupEvent class CNChangeHistoryAddSubgroupToGroupEvent class CNChangeHistoryDeleteContactEvent class CNChangeHistoryDeleteGroupEvent class CNChangeHistoryDropEverythingEvent class CNChangeHistoryEvent class CNChangeHistoryFetchRequest class CNChangeHistoryRemoveMemberFromGroupEvent class CNChangeHistoryRemoveSubgroupFromGroupEvent class CNChangeHistoryUpdateContactEvent class CNChangeHistoryUpdateGroupEvent protocol CNChangeHistoryEventVisitor
3
0
1.8k
Mar ’22
How to set Xcode to show pairings of beginning and ending of "clauses" determined by length from the left border of the code editor
How do I turn on that setting in Xcode that allows me to see how the beginning of a loop or if statement lines up with the ending of the loop as far as the number of tabs or the distance from the left border of the code editor. I have seen this on by default before. I don't know what it's called, so I don't know hot to search for it in Xcode help or on the internet or on forums.
1
0
384
Dec ’21