aws-amplify / amplify-swift

A declarative library for application development using cloud services.
Apache License 2.0
453 stars 196 forks source link

Xcode 14 fails to compile using SwiftUI Previews #1874

Closed ethan021021 closed 2 years ago

ethan021021 commented 2 years ago

Describe the bug

Using the newest Xcode 14 beta my app that uses Amplify (via SPM) will not compile using SwiftUI Preview's. Understandably it's in beta but I wanted to make sure I report this issue early on.

Steps To Reproduce

Steps to reproduce the behavior:
1. Open the newest Xcode-beta (Xcode 14)
2. Include a Swift Package that depends on Amplify
3. Open a SwiftUI View file and compile the Preview
4. Notice the error that returns from the SwiftUI Preview

Expected behavior

SwiftUI Preview should compile/run

Amplify Framework Version

1.26.1

Amplify Categories

Analytics, API, Auth, DataStore, Geo, Predictions, Storage

Dependency manager

Swift PM

Swift version

5.7

CLI version

8.3.0

Xcode version

14.0 (14A5228q)

Relevant log output

HumanReadableSwiftError

SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x00006000128be7c0):'AWSCore'>)


### Is this a regression?

No

### Regression additional context

_No response_

### Device

iPhone 13 Pro

### iOS Version

iOS 15.5

### Specific to simulators

_No response_

### Additional context

_No response_
ameter commented 2 years ago

Thanks for reporting this. Per our discussion on Discord, the betas are not supported, but we want to make sure we're aware of any issues to ensure they're resolved before release.

gongzhang commented 2 years ago

@ethan021021 I'm having the same problem here. However, I'm not quite sure if this error message is accurate. Have you tried to perform Generate Report command in the diagnostics window?

geertbleyen commented 2 years ago

This likely isn't an amplify issue. See https://developer.apple.com/forums/thread/707569. Others are having the same issues with other packages.

sebsto commented 2 years ago

I have the same issue with Xcode 14 GA

My cognito plugin initialization code is in the App Delegate.

Looks like Xcode Canvas (Preview) does not invoke this code to build the preview. The preview crashes with an error saying that Auth Cognito plugin is not initialized.

image

Here is the crash log Landmarks-2022-09-14-122515.ips.zip

Because it looks like slightly different than the issue on this thread, I opened another issue here https://github.com/aws-amplify/amplify-ios/issues/2308

ameter commented 2 years ago

We created a PR to address this problem. The fix has been merged and will be included in our next release, which should be sometime next week. In the meantime, feel free to target the main branch to test the fix, and let us know if you have any further problems with it.