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?

Post not yet marked as solved Up vote post of developer555 Down vote post of developer555
7.9k views
  • Filed as FB9452624.

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

  • 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.

Replies

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

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

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.

  • Same here. I am still seeing the same issue. Even on beta 5.

Add a Comment

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.

This is still happening with the Xcode 13 RC.

  • Strange, it's no longer happening for me.

  • For me I'm no longer getting the Block pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) I am just getting Multiple declarations of method 'insert siri intent method here' found and ignored. @developer555 did you change anything in your project or did you just upgrade to Xcode 13 RC and it fixed itself?

  • Still happening for me as well. In my case, it's in autogenerated widget intentions code.

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.

  • Well noticed. Same for me

Add a Comment

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 -

  • Seems like not working on Xcode 13.2 RC.

Add a Comment

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.

  • I tried doing this however Xcode did not regenerate the Intent Classes in Objective-C - it just got rid of my Swift ones and now I have dozens of "Cannot find type in scope" errors. How did you regenerate the files? I tried running the WidgetExtension target scheme but that did not auto-regenerate the files i need

  • Ok.. it randomly just generated the .h files at some point so scratch my previous comment... I imported the auto-generated Objective-C header files into MyProject-Bridging-Header.h file however i get a "Cannot find type 'CustomIntent' in scope" in my Swift file that utilizes the CustomIntent class and Custom Intent Enum that are defined in the auto-generated obj-c file from the SiriKit Intent Definitions file

Add a Comment

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?

  • Yes, still happening here as well.

  • Yes, for me as well.

  • This is still happening in Xcode 13.2.1. We have 2 intents generating a total of 127 warnings all of the "Multiple declarations found and ignored" it's very annoying as we had to turn off Warnings as Errors.

Add a Comment

Still happening with Xcode 13.3

  • Yes, I find the lack of support of mix and match objc & swift troubling.

Add a Comment