Auto-generated Intents code contains thousands of warnings in Xcode 13 beta

My project has auto-generated Swift code for Intents in my "ProjectName-Swift.h" file. In Xcode 12, this file had zero warnings, but in Xcode 13 it is filled with thousands of warnings.

About half of them are Block pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) - the other half are Multiple declarations of method 'handleIntent:completion:' found and ignored.

I have tried cleaning my project and deleting the Derived Data folder so far, but still getting the same errors.

Since these are auto-generated files, I can't go in and fix the errors myself. Has anyone else seen this on the Xcode 13 beta? Or have any idea how to fix it?

Yeah I have the same issue...haven't found a solution yet. I am hoping it is just a quirk of beta.

Filed as FB9452624.

Looks like is a known issue:

Siri Intents Known Issues The compiler produces warnings on the Swift code that an intent definition file generates. Because Xcode regenerates this file on subsequent builds, manually fixing the warnings isn't an effective workaround. (76283893, 78107564)

https://feedbackassistant.apple.com/news/4990

I too am seeing this. But only in one of the projects I work on. I'm hoping this gets resolved soon.

The Xcode release notes say that this issue was fixed in beta 3. It definitely was not - just tried building on the just-released beta 5 and am still seeing the same thing with 3,500 warnings in my project.

This isn't the best but its a viable workaround. I'm using the latest Xcode 12 release (Version 12.5.1 (12E507)) and using Xcode 13 beta 5 command line tools. I hope this helps.

I just realized this isn't happening solely with Intents-related code. I had added a little Swift file so that my Obj-C code could call out to the new Swift-only AppStore class that lets you open the subscription management screen in-app - the auto-generated Swift bridge has a bunch of nullability warnings for that code as well.

This is still happening with the Xcode 13 RC.

Still happening for me for a project with siri intent definition which causes autogenerated header file. Async methods (available in iOS 15) added in the generated intent definition header file have the same signature as the ones defined in iOS 13, but using completion blocks. 

This is just an example, but I have many of these and I couldn't find any solution so far: 

(void)handleCheckInChild:(CheckInChildIntent * _Nonnull)intent completion:(void (^ _Nonnull)(CheckInChildIntentResponse * _Nonnull))completion;(void)handleCheckInChild:(CheckInChildIntent * _Nonnull)intent completion:(void (^ _Nonnull)(CheckInChildIntentResponse * _Nonnull))completionHandler SWIFT_AVAILABILITY(watchos,introduced=8.0) SWIFT_AVAILABILITY(macos,introduced=12.0) SWIFT_AVAILABILITY(ios,introduced=15.0);

 Error: Multiple declarations of method 'handleCheckInChild:completion:' found and ignored

Opened: https://feedbackassistant.apple.com/feedback/9632938

Any luck with this Multiple declarations issues? I'm still facing the same :(

Still happening on Xcode 13.1 RC. We have 400 warnings with some variation of Multiple declarations of method '<method>' found and ignored from generated Siri intentions code.

I can confirm this is still happening for me too in Xcode 13.1 RC.

The duplication seems to be with the SWIFT_AVAILABILTY function. My Siri extensions have a deployment target of 12.3, but in the duplication method I can see the availability setting to iOS 15.

- (void)handleCreateDailyTask:(OP1CreateDailyTaskIntent * _Nonnull)intent completion:(void (^ _Nonnull)(OP1CreateDailyTaskIntentResponse * _Nonnull))completion;

- (void)handleCreateDailyTask:(OP1CreateDailyTaskIntent * _Nonnull)intent completion:(void (^ _Nonnull)(OP1CreateDailyTaskIntentResponse * _Nonnull))completionHandler SWIFT_AVAILABILITY(watchos,introduced=8.0) SWIFT_AVAILABILITY(macos,introduced=12.0) SWIFT_AVAILABILITY(ios,introduced=15.0);

Also, in my FB9583694 looks like there is "Less than 10" reports. That doesn't give me much hope.

I'm also seeing this issue. If anyone from the dev team is reading this, the issue appears to stem from some naming inconsistencies when translating the new async/await syntax to obj-c.

Since a Swift function with a completion block is now automatically generating two versions of the function, one with a completion block and one with the async/await syntax, it appears that Xcode is generating two method signatures that are functionally equivalent, but are using slightly different strings for the parameter names. So, I think the string matching logic is treating these as unique, but the compiler sees them as duplicates.

The generated Swift code:

@objc(handleOpenReader:completion:)
func handle(intent: OpenReaderIntent, completion: @escaping (OpenReaderIntentResponse) -> Swift.Void)

@available(iOS 15.0, macOS 12.0, watchOS 8.0, *)
@objc(handleOpenReader:completion:)
func handle(intent: OpenReaderIntent) async -> OpenReaderIntentResponse

The translated Obj-c code:

- (void)handleOpenReader:(OpenReaderIntent * _Nonnull)intent completion:(void (^ _Nonnull)(OpenReaderIntentResponse * _Nonnull))completion;

- (void)handleOpenReader:(OpenReaderIntent * _Nonnull)intent completion:(void (^ _Nonnull)(OpenReaderIntentResponse * _Nonnull))completionHandler SWIFT_AVAILABILITY(watchos,introduced=8.0) SWIFT_AVAILABILITY(macos,introduced=12.0) SWIFT_AVAILABILITY(ios,introduced=15.0);

In the objc code you can see that the two methods use different naming for the completion block. One names it completion and the other names it completionHandler. I suspect this is breaking a script somewhere in the process.

I found a solution to this issue -

Check your target's build settings and make sure Treat Warnings as Errors is set to No, after this you should be able to build you code -

Same issue here, really annoying.

Can confirm this is still an issue on 13.2 Beta. But will work if you set Treat Warnings as Errors = No. Not ideal, but is a solution for now.

I was able to eliminate the hundreds of duplicate definition warnings by changing the Intent Class Generation Language build setting (INTENTS_CODEGEN_LANGUAGE) from Swift to Objective-C. I also had to import the auto generated intent headers into my Swift bridging header, since most of my intent usage is in Swift.

I suspect this is only an issue in projects that still use Obj-C, since all the errors only originated in Obj-C files that imported my project's Swift header, and as @CannedMango pointed out, the duplicate definitions seem to be due the new async/await functions translating to the same Obj-C method signatures as the earlier completion-based functions.

The solution reported by @GyratoryCircus (down below) worked for me too!

This is still happening in Xcode 13.2.1. i have 2 intents generating a total of 80 warnings all of the "Multiple declarations found and ignored" variety.

Can someone else on this thread confirm?

Still happening with Xcode 13.3

Still happening with Xcode 13.4

Still happening with Xcode 13.4.

I "fixed" the multiple declarations issue by doing this.

#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wduplicate-method-match" #import "AppName-Swift.h" #pragma clang diagnostic pop

Same happening in Xcode 15, annoying...

Auto-generated Intents code contains thousands of warnings in Xcode 13 beta
 
 
Q