Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftUI Preview Fails #1039

Closed
peck opened this issue Feb 25, 2020 · 8 comments
Closed

SwiftUI Preview Fails #1039

peck opened this issue Feb 25, 2020 · 8 comments
Labels
build-issue Issues occurring when attempting to build
Milestone

Comments

@peck
Copy link

peck commented Feb 25, 2020

I think I've followed the installation instructions on the docs page, https://www.apollographql.com/docs/ios/installation/, and my builds works and runs on the similar just fine, but my swiftui preview breaks with this error in the diagnostics. I'm new to swiftui (though fairly familiar with Apollo/graphql from other projects) and searching didn't find similar issue.

apollo-ios -> 0.23.0
Xcode -> 11.3.1

use of unresolved identifier \'Process\'

----------------------------------------

SchemeBuildError: Failed to build the scheme "practice"

use of unresolved identifier 'Process'

Compile /Users/peck/Library/Developer/Xcode/DerivedData/practice-ffshylstkbdpuwdygwokyrmihofw/SourcePackages/checkouts/apollo-ios/Sources/ApolloCodegenLib/Basher.swift:
/Users/peck/Library/Developer/Xcode/DerivedData/practice-ffshylstkbdpuwdygwokyrmihofw/SourcePackages/checkouts/apollo-ios/Sources/ApolloCodegenLib/Basher.swift:27:16: error: use of unresolved identifier 'Process'
    let task = Process()
               ^~~~~~~

On apollo-ios 0.22.0 I don't see the issue and preview seems to generally work as expected

@designatednerd
Copy link
Contributor

Hi! What package manager are you using? Can you validate that the ApolloCodegenLib is not included in the libraries that are being added to your iOS application? It's designed to only be used with MacOS, though it seems like I should probably add some defensive if statements around that.

@designatednerd designatednerd added the build-issue Issues occurring when attempting to build label Feb 25, 2020
@designatednerd designatednerd added this to the 0.23.1 milestone Feb 27, 2020
@designatednerd
Copy link
Contributor

@peck The defensive @available statements have shipped with 0.23.1 which should prevent compilation of any of the classes that aren't available on iOS. I'm gonna close this out, please reopen if you're still seeing this issue when using 0.23.1. Thank you!

@peck
Copy link
Author

peck commented Feb 27, 2020

Apologies for not seeing your first reply, didn’t get a notification from github for that one.

I’ll give the new version a try and see if it fixes it.

To answer the question, I’m using swift package manager and did not have codegen lib included.

Thanks!

@peck
Copy link
Author

peck commented Feb 28, 2020

Following up, I tried with the latest release and get the same error

image

There is a very real possibility that I did something wrong to get here, and I don't have quite enough experience with the swift ecosystem yet to be of much help on tracking down the core issue, but Im still seeing it. Maybe best to keep the issue closed and if others have it can be revisited?

@iancanderson
Copy link

👋 I got the same error using 0.23.0, and still in 0.23.1. Downgrading to 0.22.0 fixed the issue for me as well - SwiftUI preview is working again

@designatednerd
Copy link
Contributor

What the...oy. Yeah 0.22.0 doesn't have the ApolloCodegenLib at all so it would definitely not have this problem.

Reopening - can you please take a look at the Build Phases for the target you're running SwiftUI with and make sure you do not have the ApolloCodegenLib in either your Link Binary With Libraries phase or your Embed Frameworks phase?

@TizianoCoroneo
Copy link
Contributor

TizianoCoroneo commented Mar 5, 2020

I had setup Apollo with SwiftPM, and I'm importing it as a dependency for another local package, so there is no Build phase to look at 😅 About the target I'm using, it doesn't attempt to link ApolloCodegenLib or embed its framework; but I've found a different fix and opened a PR.
#1066

@designatednerd designatednerd modified the milestones: 0.23.1, Next Release Mar 5, 2020
@designatednerd
Copy link
Contributor

Actual fix shipping with 0.23.2 courtesy @TizianoCoroneo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-issue Issues occurring when attempting to build
Projects
None yet
Development

No branches or pull requests

4 participants