Posts

Post not yet marked as solved
0 Replies
112 Views
I'm developing iOS message extension to filter the unwanted message. The plugin needs a help from server to filter the message. However, the iOS returned the error NSURLErrorDomain while requesting the server. Based on the official document, I defined the key/value pair in Info.plist of Message Extension. ILMessageFilterExtensionNetworkURL has value: https://mydomain.io/api/v1/sms The code that I test the request as follows: let url = URL(string: "https://mydomain.io/api/v1/sms")! var request = URLRequest(url: url) request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.setValue("you-value-goes-here", forHTTPHeaderField: "X-API-KEY") let task = URLSession.shared.dataTask(with: request) { data, _, error in if let data = data { print(data) } else if let error = error { print("Http failed: \(error)") } } task.resume() From the stack trace, as far as I known, there is a problem with dns resolution. Why does this happened and how to fix this case? [0] (null) "_kCFStreamErrorCodeKey" : Int32(-72000) [1] (null) "NSUnderlyingError" : domain: "kCFErrorDomainCFNetwork" - code: 18446744073709550613 [2] (null) "_NSURLErrorFailingURLSessionTaskErrorKey" : "LocalDataTask <B496A974-7009-4FCE-BF45-FEC07BA1E8DF>.<1>" [3] (null) "_NSURLErrorRelatedURLSessionTaskErrorKey" : 1 element [4] (null) "NSLocalizedDescription" : "A server with the specified hostname could not be found." Thanks
Posted
by ntk19.
Last updated
.
Post not yet marked as solved
0 Replies
141 Views
I'm trying to create a "hello world" a Message Filtering extension for iOS based on the following steps: Create a new project. Go to File -> Target -> Add Message Filter App Extension, enter a name MyMessageFiltering. Xcode generate the folder MyMessageFiltering contains MessageFilterExtension.swift In the MessageFilterExtension.swift, add one line below the handle function as follow: func handle(_ queryRequest: ILMessageFilterQueryRequest, context: ILMessageFilterExtensionContext, completion: @escaping (ILMessageFilterQueryResponse) -> Void) { NSLog("FILTEREXTENSION - handle") // add the log to see check the function handle Run the app Enable the app in message extension on iPhone by Settings -> Message -> Unknown & spam Start the console app and record the phone. Send a sms message to iPhone by an unknown number (which is not existing in iPhone contact). There is no log from the console app or XCode console What steps did I do wrong to test the sms extension filtering ?
Posted
by ntk19.
Last updated
.