amplify-swift icon indicating copy to clipboard operation
amplify-swift copied to clipboard

Xcode 14 fails to compile using SwiftUI Previews

Open ethan021021 opened this issue 2 years ago • 5 comments

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_

ethan021021 avatar Jun 07 '22 17:06 ethan021021

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.

ameter avatar Jun 07 '22 19:06 ameter

@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?

gongzhang avatar Jun 08 '22 06:06 gongzhang

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

geertbleyen avatar Aug 25 '22 10:08 geertbleyen

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

sebsto avatar Sep 14 '22 11:09 sebsto

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.

ameter avatar Sep 17 '22 00:09 ameter