AppIntent complie issue & manual remove AppIntent dialog

1.When I attempted to open the subsequent AppIntent within the perform method of the AppIntent instance, I always received the following error:

How to solve the problems of inconsistency of this type? I couldn't find any sample code.

2.When I used method 'Button(intent: OpenAppIntent())' to open my app through the dialog custom view of AppIntent, but I couldn't find a way to close this AppIntent dialog. How can i remove this dialog?

Don't know. You should probably provide us with some code.

We can't tell from that.

And, in future, PLEASE don't post screenshots of errors. They can't be searched for, so when someone else has the exact error they won't see this post and any possible solution.

@available(iOS 16.0, macOS 13.0, watchOS 9.0, tvOS 16.0, *)
struct OpenPhotoRecognizing: AppIntent {

    static let title: LocalizedStringResource = "Read photo"
    static let description = IntentDescription("")
    static let openAppWhenRun: Bool = false
    
    @Parameter(title: "input photo")
    var inputPhoto: IntentFile?

    static var parameterSummary: some ParameterSummary {
        Summary {
            \.$inputPhoto
        }
    }
    
    
    func perform() async throws -> some IntentResult & OpensIntent {
        
        if let _ = inputPhoto  {
            return .result(opensIntent: OpenAppIntent())
        }
        
        return .result(opensIntent: MessageDialogIntent())
    }
    
}

As shown in the above code, the subsequent two different types of intentions cannot be executed.

AppIntent complie issue & manual remove AppIntent dialog
 
 
Q