facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.73k stars 3.51k forks source link

Unable to compile UI test scheme when using SPM dependency #1187

Closed davidrothera closed 3 years ago

davidrothera commented 4 years ago

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

Goals

Run test scheme for UI testing for usage by things like Fastlane

Expected Results

Product compiles and runs/tests

Actual Results

Test scheme fails to compile with No such module 'FBSDKCoreKit' exception

Steps to Reproduce

Checkout sample project here and try and run/build/test the 'SPMUITests' scheme

davidrothera commented 4 years ago
Screenshot 2020-01-19 at 13 44 16
davidrothera commented 4 years ago

Also, any of the other Swift packages I use don't cause this, only this one.

joesus commented 4 years ago

This is interesting.

I cloned the sample project and ran it with Xcode 11.3.0. I was able to run the UI Tests without issue. Looks like the package version it used was 5.14.0 - the specific revision from the package.resolved file is: 5546ad5b77171b0442a2f2d7885556a62cbe91d7 but that shouldn't change as long as the version is 5.14.0.

Steps I took to try and repro:

  1. cleaned the build folder
  2. removed derived data
  3. reset the package caches.
  4. built for testing (succeeded)
  5. ran the tests in SMPUITests.swift from Xcode

I'll double check that this isn't an Xcode 11.3.0 vs 11.3.1 issue.

joesus commented 4 years ago

Also thank you for the SPM feedback! Really want this to be a first-class experience for all our devs and that totally includes UITests. :D

davidrothera commented 4 years ago

@joesus running the tests from inside worked ok for me but what broke was when trying to compile/run/test the SPMUITests scheme

joesus commented 4 years ago

@joesus running the tests from inside worked ok for me but what broke was when trying to compile/run/test the SPMUITests scheme

That is really strange. I'm seeing it work. My thought is that this must be a difference in our environments. Any ideas on how to get to the bottom of this?

Screen Shot 2020-01-20 at 12 30 09 PM
davidrothera commented 4 years ago

Ok so after rolling back to 11.3 I still had the same issues:

However I do seem to have got it working by manually adding the libraries to the SPMUITests target as per screenshot and now things are working 🙄

Screenshot 2020-01-21 at 08 59 11
joesus commented 4 years ago

Strange. I'm going to close for now since I'm not sure what work could be done to make this more consistent. Please feel free to reopen if you have any ideas for actions we could take. Thanks again for keeping an eye on things. :D

mrgrauel commented 4 years ago

@joesus I have the same issue but could figure out that https://github.com/kishikawakatsumi/IBPCollectionViewCompositionalLayout/issues/135 also has the problem. I use 7 other swift packages and all of them are fine. It gotta be something in these packages.

joesus commented 4 years ago

@joesus I have the same issue but could figure out that kishikawakatsumi/IBPCollectionViewCompositionalLayout#135 also has the problem. I use 7 other swift packages and all of them are fine. It gotta be something in these packages.

Are you able to manually add the libraries to the target like in the post above? If you do that is there an error message that could help us debug this?

davidrothera commented 4 years ago

I should have followed up earlier but I ended up still having issues after what looked to have been fixed so there was probably something cached which was keeping it on life support.

In the end I ended up reverting to CocoaPods as SPM was eating all of my already limited time :(

joesus commented 4 years ago

Apparently definitely still an issue. Will continues to investigate.

mrgrauel commented 4 years ago

@joesus I have the same issue but could figure out that kishikawakatsumi/IBPCollectionViewCompositionalLayout#135 also has the problem. I use 7 other swift packages and all of them are fine. It gotta be something in these packages.

Are you able to manually add the libraries to the target like in the post above? If you do that is there an error message that could help us debug this?

I tried adding the library to the target but got the same issue (no such module) for both for IBPCollectionViewCompositionalLayout and sometimes the issue for FSDKCorekit. Wasn't really reproducible.

All the other pods are 100% Swift. I guess that could be something 🤔

joesus commented 4 years ago

I can't say for sure but testing this morning on #1231 seems to be working... this was with a fresh project. Didn't add the libraries to the test target specifically, just added them with the normal package manager dialog, specified the branch in that pr and everything 'just worked'.

As far as IBPCollectionViewCompositionalLayout goes, that library is unrelated to the Facebook SDK and will likely need separate fixes.

mrgrauel commented 4 years ago

I will check that on Monday morning (European TimeZone). Maybe it's related to old ui-testing target configuration. I'll try to create a new one in the given project and also in a brand new project. That would be awesome if it's only a target configuration issue.

@joesus did you use the stable Xcode 11.3.1 (11C504)?

mrgrauel commented 4 years ago

It's strange. Adding a new Test Target is no problem and run the test, but as soon as you need a schema for Fastlane/Screenshots I get the no such module.

Bassyouni commented 4 years ago

Any updates?

rfldhs commented 4 years ago

It's strange. Adding a new Test Target is no problem and run the test, but as soon as you need a schema for Fastlane/Screenshots I get the no such module.

@mrgrauel you found any solution? currently running into the same problem with needing a scheme for fastlane snapshot and recieving a missing module error ... 👎

stale[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.