Unwanted Communication extension doesn't work.

I am trying Unwanted Communication Reporting Extension.

But it doesn't work.


https://docs.developer.apple.com/documentation/sms_and_call_reporting/sms_and_call_spam_reporting


I only added the target to My Project and ran the app with sample code.

(I had entered my sms number to be reported to info.plist.)

Then I enabled the Unwanted Communication extension in the Settings app.

I selected an call to report in Phone app.

I expected that done button will be changed to be enabled after loading ILClassificationUIExtensionViewController.

But it didn't happen.


Does anyone know the reason?

Replies

It was not associated with sample class on StoryBoard.

When the target is added, I hope that sample class is already associated.

You have to enable the done button through code.

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        // Notify the system when you have completed gathering information
        // from the user and you are ready with a classification response
        self.extensionContext.isReadyForClassificationResponse = true
    }


line -06 is responsible for making done enable. You need to create a View and attach to you class. So that it executes ViewDidAppear().


not related: but do you see the same report button in message app? I can't see it either on swipe or long press of a thread.

yes, i am able to see it. by long press a message thread, there will be a pop up at the bottom, showing copy, and more.... By clicking more, you will be able to see report message at the bottom.


Not related: are you able to communicate between unwanted communication extension and the containing app? I tried using userdefaults with the same app group. but it keeps showing this error: setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access, switching to read-only. This problem only exists if i set key-value in app extension and read in containing app, the other way works fine though. 😟

Morrandir Thank you for replying back. I haven't reached at that point where I could help.. Im stuck on the initial steps :/

Have you done any specific configuration for this? I have been banging my head on this for a week now. Is there any special settings that we have to enable? Or does the message needs to be special in some way? Please look at my steps and tell me if I missed anything.

Steps:
1. Create New Project.2. Add New Target "Unwanted Communication"
3. Open info.plist for extension and specify phone number
4. Build and run on iOS 12 iphone 8.

5. once application ran. hit home button, went to settings and enable "sms/call reporting" under Phone App. Select my app.
6. Open Message App.


Actual:

1. If I do long press thread loose focus.
2. On 3d click thread opens a view with custom replies.

3. If I long click a message then it shows me menu of copy or more. on clicking more It goes into delete mode.
Seems like extension never got registered for messages. I am not sure what I'm missing...


Thank you!