Post

Replies

Boosts

Views

Activity

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
255
Jun ’22
When does iOS purge local storage?
This documentation: Documentation/Bundle/Resources/Information Property List/Data and storage/NSSupportsPurgeableLocalStorage says: Property List Key NSSupportsPurgeableLocalStorage A Boolean value indicating whether the app continues working if the system purges the local storage. Under what conditions does the system "[purge] the local storage", and does this mean the entire local storage for the app? I can see how when a user deletes an app the local storage would be deleted, but then the app would not continue working, since it's no longer on the device.
0
0
811
Jul ’22
How do I get information on messages that have been sent in Messages app in iOS?
I have wondered before how I can find out what messages have been sent and perhaps even to whom and from whom. What is the underlying technology behind the search feature in iOS when the user swipes right from the first screen of the home screen? Is that part of Siri. Setting group Siri and Search together. Does the search feature I speak of use Intents, and is that made accessible to developers. I have also noticed that there is an intent property to the extension context object that passes information between a host app and another app's share extension. I'm brainstorming and looking for any ideas. I hope someone out there have good information for me. macOS has Spotlight. Is that available on iOS?
0
0
1.2k
Jul ’22
How to cache Contacts in iOS?
I want to check if my code to cache contacts data while my iOS app is running is done well or not. Anyone have any samples I can look at. I did a search on the internet and cannot find much. Maybe code to cache any time of cache would help for me to look at. I am using Xcode 13.4.1, and my app is intended to install on iOS 12.0 up to the most current iOS version. I seem to remember a search class in one of Apple's frameworks for iOS. I don't remember if that was part of the Contacts Framework. I also will have a cache for the Contacts data that I store in CloudKit, so I take that into account to be looking for any way that might make the Contacts cache and the CloudKit cache work together.
0
0
661
Aug ’22
How do I get my iOS app to contribute an action for a shortcut?
When I go to the Shortcuts app and add an action, there is a tab that lets me see Apps that has actions I can use. How do I make my iOS app be able to contribute actions for users to use in a shortcut, so that a user creating a shortcut can add an action that does something in my app? An example of this is the Walmart app. A user can create use an action that allows him to check in.
0
1
939
Sep ’22
How do I write thread-safe code that uses a completionHandler with a function that delegates code to an instance of OperationQueue?
I've been using the CloudKitShare sample code found here as a sample to help me write code for my app. I want to use performWriterBlock and performReaderBlockAndWait as found in BaseLocalCache using a completionHandler without violating the purposes of the design of the code, which focuses on being thread-safe. I include code from CloudKitShare below that are pertinent to my question. I include the comments that explain the code. I wrote comments to identify which code is mine. I would like to be able to use an escaping completionHandler if possible. Does using an escaping completionHandler still comply with principles of thread-safe code, or does it in any way violate the purpose of the design of this sample code to be thread-safe? If I use an escaping completionHandler, I would need to consider when the completionHandler actually runs relative to other code outside of the scope of the actual perform function that uses the BaseLocalCache perform block. I would for one thing need to be aware of what other code runs in my project between the time the method executes and the time operationQueue in BaseLocalCache actually executes the block of code and thus the completionHandler. class BaseLocalCache { // A CloudKit task can be a single operation (CKDatabaseOperation) // or multiple operations that you chain together. // Provide an operation queue to get more flexibility on CloudKit operation management. // lazy var operationQueue: OperationQueue = OperationQueue() // This sample ... // // This sample uses this dispatch queue to implement the following logics: // - It serializes Writer blocks. // - The reader block can be concurrent, but it needs to wait for the enqueued writer blocks to complete. // // To achieve that, this sample uses the following pattern: // - Use a concurrent queue, cacheQueue. // - Use cacheQueue.async(flags: .barrier) {} to execute writer blocks. // - Use cacheQueue.sync(){} to execute reader blocks. The queue is concurrent, // so reader blocks can be concurrent, unless any writer blocks are in the way. // Note that Writer blocks block the reader, so they need to be as small as possible. // private lazy var cacheQueue: DispatchQueue = { return DispatchQueue(label: "LocalCache", attributes: .concurrent) }() func performWriterBlock(_ writerBlock: @escaping () -> Void) { cacheQueue.async(flags: .barrier) { writerBlock() } } func performReaderBlockAndWait<T>(_ readerBlock: () -> T) -> T { return cacheQueue.sync { return readerBlock() } } } final class TopicLocalCache: BaseLocalCache { private var serverChangeToken: CKServerChangeToken? func setServerChangeToken(newToken: CKServerChangeToken?) { performWriterBlock { self.serverChangeToken = newToken } } func getServerChangeToken() -> CKServerChangeToken? { return performReaderBlockAndWait { return self.serverChangeToken } } // Trial: How to use escaping completionHandler? with a performWriterBlock func setServerChangeToken(newToken: CKServerChangeToken?, completionHandler: @escaping (Result<Void, Error>)->Void) { performWriterBlock { self.serverChangeToken = newToken completionHandler(.success(Void())) } } // Trial: How to use escaping completionHandler? with a performReaderBlockAndWait func getServerChangeToken(completionHandler: (Result<CKServerChangeToken, Error>)->Void) { performReaderBlockAndWait { if let serverChangeToken = self.serverChangeToken { completionHandler(.success(serverChangeToken)) } else { completionHandler(.failure(NSError(domain: "nil CKServerChangeToken", code: 0))) } } } }
0
0
733
Sep ’22
Where is the message instance property of MFMessageComposeViewController?
Why am I not seeing the message instance property of MFMessageComposeViewController? When I type the following, I get a code-time error message in Xcode that says "Value of type 'MFMessageComposeViewController' has no member 'message'" messageComposeViewController.message // error message: "Value of type 'MFMessageComposeViewController' has no member 'message'" There is nothing that explains this in the official Apple documentation: Documentation/Message UI/MFMessageComposeViewController/message
0
0
1.4k
Sep ’22
How do I share content from my iOS app using the standard iOS share sheet?
It looks like the Share Extension allows other "host" apps to share content with my "containing" app. How do I share content from my app with other apps using the standard iOS share sheet? I have found information on how to use UISheetPresentationController and UIActivityViewController. What is Apple's designated standard API to share content from my iOS app? I would think their designated way would show all the the apps that the share sheet can share with. Is UIActivityViewController the way that is most intended by Apple to do this?
0
0
633
Oct ’22