Xcode 13 beta | Failed to build module 'Network' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug

I have a project which has iOS 10.0 deployment target in which I import Network framework in some class and conditionally using it depending on the host app’s iOS version.  

With Xcode 13 beta 4(13A5201i), I am able to compile and run the project successfully while debugging on iPhone device but it gives below error.

This was working fine with Xcode 12.5.1

/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Network.swiftmodule/armv7-apple-ios.swiftinterface:1254:19: 'NWConnection' is only available in iOS 12.0 or newer

/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Network.swiftmodule/armv7-apple-ios.swiftinterface:1254:1: Add @available attribute to enclosing extension

/Application/NWBrowserManager.swift:10:8: Failed to build module 'Network' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug

  • I have the same problem. Extremely frustrating...

Add a Comment

Replies

If you have a project that builds with Xcode 12.5.1 and fails to build with Xcode 13.0b4, you should report that as a bug against Xcode. If you can attach a buildable project that demonstrates the issue, that’d be great. If not, you can at least attach a full build transcript:

  1. Go to the Report navigator (View > Navigators > Show Report Navigator).

  2. In the navigator on the left, select the failed build.

  3. At the top right of the editor you should see an Export button. Click that.

  4. Save the transcript somewhere convenient and then attach that to your bug.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Here is the bug number: FB9451540 (Xcode gives error while archiving). Please let me know if anything additional require to expedite the resolution for this issue. Thanks

Add a Comment

FB9451540

Thanks.

It turns out that I’m able to easily reproduce this myself, so I added my comments and a test project to your bug.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Thanks for confirming the issue. So can you please let us know when we can expect the resolution? Will it be in Xcode beta 5?

Add a Comment

So can you please let us know when we can expect the resolution?

I’m not able to predict the future, alas. Feedback Assistant should notify you when the fix starts seeding.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have the same issue in Xcode 13 beta 5. My problem exists only when I run xcodebuild from the command line. Toolchain and xcode version is set correctly to beta. Are there any updates in Feedback assistant for this bug?

  • Still waiting for update and next xcode version

  • You and me both )-:

Add a Comment

I have the same problem.

The specific bug mentioned here (FB9451540) was fixed in the released version of Xcode 13.0. Indeed, I just verified that fix myself. Specifically, I took the project that I attached to the bug report, which was previously failing to build, and successfully built it with Xcode 13.0 running on macOS 11.6.

Are you still using a beta Xcode for some reason? If so, which one? And why?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Add a Comment

Has this one got fixed? Or is there any workaround? I experience this with my CI builds of my SDK, but weirdly not builds that I do locally. I'd really appreciate some help.

  • Yes, this issue got fixed in Xcode 13.0

Add a Comment

Has this one got fixed?

Which one? If you’re talking about FB9451540, I definitely verified that as fixed per my post above.

If you’re talking about the other issue that julian1232 mentioned, that doesn’t seem to be related to Network framework and thus somewhat outside of my bailiwick.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

This issue is active again on latest Xcode version 14.3. This version also came with a lot of another issues, this is not the only one. What a frustrating IDE.

I’m not seeing this problem in Xcode 14.3. Now, the original problem was reported as being when you build for iOS 10 and the minimum supported deployment target for Xcode 14.3 is iOS 11, so I can’t test it exactly as above. However, I was able to do the following:

  1. Create a new project from the iOS > App template.

  2. Add an import of Network framework.

  3. Set the simulator run destination.

  4. Build it.

  5. Set the deployment target back to iOS 11.

  6. Build it.

  7. Set an actual device deployment target.

  8. Build it.

Can you post more details about how your reproducing it?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Many of these replies may be truthful, but it seems like there are some inconsistencies. It works for some people and it won't work for others. In my case, I'm developing an SDK that uses 3rd party Swift Packages internally. Originally, I thought this error was being thrown because I upgraded to Xcode 15. Turns out, it was completely unrelated. If you are using 3rd party libraries and want to export a Framework, you must include the "@_implementationOnly" tag in front of the imports. Example: "@_implementationOnly import BoltsSwift".

If you do this, it will not include these 3rd party library imports in the binary modules within the framework. This is great because the users of your framework don't care about the 3rd party libraries used in the back-end. Hope this helps at least one person! I rarely see anything online about the @_implementationOnly tag.

  • You are my hero, @_implementationOnly was the catch, tnx!

  • it solved my problem too, danke.

Add a Comment

The issue discuss above was a specific bug in the way that the network Network framework was set up in the macOS SDK.

Regarding @_implementationOnly, that’s definitely a useful tool. The underscore prefix indicates that it’s not yet officially part of the Swift language, but it’s very commonly used despite that. And the good news here is that there’s a new effort to standardise this. See [Pitch] Access-level on import statements over on Swift Evolution.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"