I'm trying to develop a message filtering extension for iOS. My steps as follows:
- Create a new project.
- Go to File -> Target -> Add Message Filter App Extension, enter a name
MyMessageFiltering. Xcode generate the folderMyMessageFilteringcontainsMessageFilterExtension.swift - In the
MessageFilterExtension.swift, add one line after thehandlefunction as follow:
func handle(_ queryRequest: ILMessageFilterQueryRequest, context: ILMessageFilterExtensionContext, completion: @escaping (ILMessageFilterQueryResponse) -> Void) {
// First, check whether to filter using offline data (if possible).
NSLog("FILTEREXTENSION - 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.
There is no log from the console app or XCode console
What steps did I do wrong to test the sms extension filtering ?
It is pretty late to answer this question also you might have figured it out already but it is for somebody out there facing the same problem
Actually the steps you have followed to create a message-extension is correct, however assuming from the steps you have followed you're only running the application's target (in your case step 4) there should one more step in-between step 4 and step 5 and that extra step would be as follows :-
As our extension is of type message-filter extension it is perfectly fine to run in Messages App and then can receive all callbacks when the sms arrives in your iPhone and hence you will also be able to see your log.
Please take a look at the images i'm attaching in a sequential manner.
MyMessageFiltering extension
Need to run your extension in iPhone's Messages app