Post

Replies

Boosts

Views

Activity

Why does the intent property not show for NSExtensionContext?
The intent property doesn't even show when I initialize an instance of NSExtensionContent, as in the following code: let extensionContext = NSExtensionContext() extensionContext.intent I get an error saying: Value of type 'NSExtensionContext' has no member 'intent' Why is this? The documentation doesn't say it is deprecated. Even when something is deprecated, it still shows in Xcode.
1
0
1.4k
Jul ’22
When can I run a synchronous code by executing DispatchQueue.main.sync { }?
I tried running the following code and it raises the following error every time: DispatchQueue.main.sync { } Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) I found this post on stackoverflow that says to never run synchronous code on the main queue: DispatchQueue crashing with main.sync in Swift I had assumed that because the sync { } method is there that means there is some context that it can be used. Is there absolutely no use for executing synchronous code on the main queue?
1
0
1.2k
Jul ’22
Does synchronous mean that by definition it is run on and called from separate threads, or does it have to be that way because of the way things are?
Does an operation that is synchronous have to be run on a separate thread? I think so, otherwise it would deadlock right from the beginning, if it’s run on and called from the main thread. What about if it’s run on and called from a thread other than the main thread? Will it deadlock? This question arose when I was reading the following content at Documentation/Foundation/Task Management/Operation Asynchronous Versus Synchronous Operations When you add an operation to an operation queue, the queue ignores the value of the isAsynchronous property and always calls the start() method from a separate thread. Therefore, if you always run operations by adding them to an operation queue, there is no reason to make them asynchronous.
1
0
684
Jul ’22
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
Determining whether a vCard has a duplicate on a current iOS device?
What criteria does Apple use to determine whether a vCard sent for example as an email attachment has a duplicate? I would think there has to be more in common between the duplicates than just the given name and the family name? Does Apple say whether the given name, family name, and address enough similarities to consider two contacts duplicates of each other?
1
0
583
Jun ’22
Where can I find a logical disjunction operator or function for Swift?
Is there a logical disjunction operator or function in Swift? Even better, is there a logical disjunction that works with optional variables instead of boolean variables that returns an object when true, and returns nil when false? A logical disjunction evaluates two boolean variables, and if at least one of them is true, then the return value is true. If neither variables is true, then the return value is false.
1
0
1.1k
Jun ’22
How to enable my iOS app to allow content shared in Messages to automatically appear in my app.
I would like my app to allow the Messages app to allow content shared with the user of the Messages app in iOS to automatically appear in my app when my app is selected in iOS Settings->Messages->Shared with You. I can't find information saying I can do this. The Share app extension doesn't enable this. Please someone say they know how to do this?
0
0
251
Jun ’22
what can you use after the escape character "\"?
Where can I find a list of those characters that can be put in front of the ""character in a string literal, such as "n", thus the following would print a new line? I don't know what those characters are called. I thought they were called "escape characters" or "format specifiers". print("\n", terminator: "")
1
0
382
Jun ’22