If a unwanted communication extension target is created,then the auto-generated template code doesn't work. This can very quickly be demonstrated by:
- In Xcode create a new iOS project
- In that project create an unwanted communication extension target (I called it cheese so its easy to see in the console)
- Add some logging lines to the UnwantedCommunicationReportingExtension code that was created.
- Install app to iPhone, and select it in the settings app
- Swipe on a call in the call history.
The following lines can be seen in the iPhone console:
Unknown class _TtC6cheese13MainInterface in Interface Builder file.
View controller is not of class ILClassificationUIExtensionViewController
None of the logging lines added to the code are displayed, also the Done button in the presented UI is disabled - but in the code that is generated by the target templete is:
self.extensionContext.isReadyForClassificationResponse = true
Which is supposed to enable the Done button.
In the storyboard that gets created the custom class is set to MainInterface:
How are you supposed to get this stuff working if it doesn't work out of the box? MainInterface isn't being recognized as the view controller class, and in the drop down UnwantedCommunicationReportingExtension doesn't appear.
class UnwantedCommunicationReportingExtension: ILClassificationUIExtensionViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
NSLog("viewDidAppear")
// Notify the system when you have completed gathering information
// from the user and you are ready with a classification response
self.extensionContext.isReadyForClassificationResponse = true
}
// Customize UI based on the classification request before the view is loaded
override func prepare(for classificationRequest: ILClassificationRequest) {
NSLog("prepare")
// Configure your views for the classification request
}
// Provide a classification response for the classification request
override func classificationResponse(for request:ILClassificationRequest) -> ILClassificationResponse {
return ILClassificationResponse(action: .none)
}
}