79427950

Date: 2025-02-10 18:18:47
Score: 2
Natty:
Report link

I've similar issues in one of my POC.

The problem occurs because of the recursive app opening behavior. This way we can fix it, while returning IntentResult type instead of OpaqueType.

struct NotifyFriendsScreen: AppIntent {
    static var title: LocalizedStringResource = "Connect With Friends"
    static var description = IntentDescription("This will activate tell-them to notify your friends. Then you can proceed to app.")
    
    @Parameter(title: "❗️Choose App❗️", optionsProvider: SupportedApps())
    var selectedApp: String
    
    @MainActor
    func perform() async throws -> IntentResult {
        if UserDefaults.standard.bool(forKey: "openTellThem") {
            showTargetViewController()
            UserDefaults.standard.set(false, forKey: "openTellThem")
            return .result()
        } else {
            return .result()
        }
    }
}

I hope this will fix your issue.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): 've similar issue
  • Low reputation (0.5):
Posted by:  Engineer