Post

Replies

Boosts

Views

Activity

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.1k
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
657
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
936
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
732
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
625
Oct ’22
How do I use UIActivityViewController to share text with other users of my iOS app?
I am using a Share Extension that shares a simple text, thus NSExtensionActivationSupportsText is in my Info.plist. How would I configure UIActivityViewController to enable my app to share test with other uses of my app? Which classses would I need to use? I actually need to pass a URL, more specifically a URL generated by CloudKit framework to use CKShare and UICloudSharingController, but for now I need to learn how to simply share test information.
0
0
718
Oct ’22
How to make my iOS app appear in UICloudSharingController so that it could share a CKShare.url with my app to other users of my app?
What App Extensions and Entitlements or any other settings or anything else do I need to do in order to allow my app to use CloudKit sharing to share CKShare.url with other users of my app so that one user can share with another user by sending the URL to my app in addition to other apps such as Messages and Mail?
0
0
677
Oct ’22