1 Reply
      Latest reply on Apr 9, 2020 2:29 PM by HiddenJester
      HiddenJester Level 1 Level 1 (0 points)

        Is anybody else seeing problems with NSUserActivity and the Intents extension after upgrading to Xcode 11.4 and/or iOS 13.4? I have a project that was working the last time I built it, but that was prior to the 11.4 release. Today, when trying to build it I find that a debug build seems to work fine when attached to a debugger. But if I launch the app directly from Springboard I will get a crash and an unrecognized selector error message in the console as soon as I call setSuggestedInvocationPhrase.

         

        I made a simple test case for my Feedback Assistant report. here's the core function that exhibits the problem.

         

        import SwiftUI
        import Intents
        
        struct ContentView: View {
            var body: some View {
                if testForSelector() {
                    return Text("You can call setSuggestedInvocationPhrase")
                } else {
                    return Text("setSuggestedInvocationPhrase will crash if you call it.")
                }
            }
        }
        
        extension ContentView {
            func testForSelector() -> Bool {
                let activity = NSUserActivity(activityType: "Testing Activity")
               
                return activity.responds(to: #selector(setter: INIntent.suggestedInvocationPhrase))
            }
        }

         

        I'm guessing that I've done something super-weird to cause this, but it *looks* very straightforward. Hoping somebody else has seen something similar.

         

        If you do see something similar I submitted a Feedback Assistant at FB7645803.