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

Installation via CocoaPods is Broken #94

Closed
rogerluan opened this issue Apr 19, 2021 · 28 comments · Fixed by #102
Closed

Installation via CocoaPods is Broken #94

rogerluan opened this issue Apr 19, 2021 · 28 comments · Fixed by #102

Comments

@rogerluan
Copy link
Contributor

Follow up on #88 and #89

#89 actually resolved the build-time issue but it actually crashes the app during runtime.

I tried importing XCTest.framework in my project (embed & sign, embed without signing, do not embed), but none of these options worked for me.

@rogerluan
Copy link
Contributor Author

Temporary solution was to downgrade to https://github.com/WeTransfer/Mocker/releases/tag/2.2.0

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label May 20, 2021
@rogerluan
Copy link
Contributor Author

Bump

@letatas
Copy link
Contributor

letatas commented May 27, 2021

Any news on this problem... I can't run any app with Mocker installed via CocoaPods, error appears at launch:

dyld: Library not loaded: @rpath/XCTest.framework/XCTest
  Referenced from: /Users/.../myapp.app/myapp
  Reason: image not found

@github-actions github-actions bot closed this as completed Jun 7, 2021
@rogerluan
Copy link
Contributor Author

rogerluan commented Jun 7, 2021

This is still a problem 😕 can we prevent the bot from auto closing issues @AvdLee ? It's not working correctly, it's not respecting the rule it says 😖

@AvdLee AvdLee reopened this Jun 7, 2021
@AvdLee AvdLee removed the Stale label Jun 7, 2021
@AvdLee
Copy link
Contributor

AvdLee commented Jun 7, 2021

@letatas @rogerluan sorry for this. Unfortunately, we currently don't have time to add better support for CocoaPods. We're using SPM heavily and recommend using that instead. I understand this isn't always possible, so feel free to open a PR to fix support for CocoaPods accordingly.

@rogerluan
Copy link
Contributor Author

Bump, don't close 🙏

@AvdLee AvdLee removed the Stale label Jul 8, 2021
@WeTransfer WeTransfer deleted a comment from github-actions bot Jul 8, 2021
@AvdLee
Copy link
Contributor

AvdLee commented Jul 8, 2021

@rogerluan it's too bad it hasn't been picked up yet, I feel sad about that! Have you had time to look up a potential solution to this by any chance?

@rogerluan
Copy link
Contributor Author

Thanks for the follow up @AvdLee - I haven't investigated the CocoaPods issue because I was able to upgrade my whole infrastructure to use SPM instead 🙈 So that became a no-problem to me 😅

@github-actions github-actions bot added the Stale label Aug 9, 2021
@rogerluan
Copy link
Contributor Author

Ping

@WeTransfer WeTransfer deleted a comment from github-actions bot Aug 17, 2021
@AvdLee AvdLee removed the Stale label Aug 17, 2021
@BasThomas
Copy link
Contributor

Will see if I can take a look at this one.

@BasThomas
Copy link
Contributor

Alright, this is the output from pod install, given the following podfile:

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'MyCoolProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  pod 'Mocker', '~> 2.2.0'

  target 'MyCoolProjectTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MyCoolProjectUITests' do
    # Pods for testing
  end

end

Output

bas@Bas-iMac MyCoolProject % pod install
Analyzing dependencies
Downloading dependencies
Installing Mocker (2.2.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `MyCoolProject.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

[!] Automatically assigning platform `iOS` with version `14.0` on target `MyCoolProject` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] The `MyCoolProjectUITests [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-MyCoolProject-MyCoolProjectUITests/Pods-MyCoolProject-MyCoolProjectUITests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `MyCoolProjectUITests [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-MyCoolProject-MyCoolProjectUITests/Pods-MyCoolProject-MyCoolProjectUITests.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] Your project does not explicitly specify the CocoaPods master specs repo. Since CDN is now used as the default, you may safely remove it from your repos directory via `pod repo remove master`. To suppress this warning please add `warn_for_unused_master_specs_repo => false` to your Podfile.

@BasThomas
Copy link
Contributor

After that, however, I can import Mocker in my tests, use it, and build it for testing. Can you provide (more) steps to reproduce?

@rogerluan
Copy link
Contributor Author

rogerluan commented Aug 25, 2021

@BasThomas Thanks for helping us get to the bottom of this issue! 🙏

The issue I'm describing only happens after #89 got merged, so you gotta use a more recent version of Mocker (2.2.0 is quite dated) - in fact, I posted here that using 2.2.0 would make everything work as expected again #94 (comment) 😄. Here's a project using 2.5.3 where this issue can be reproduced:

mocker-test.zip

The crashlog from the app launch (I ran on Simulator, but it crashes on physical devices as well):

dyld: Library not loaded: @rpath/XCTest.framework/XCTest
  Referenced from: /Users/rogerluan/Library/Developer/CoreSimulator/Devices/B2D48E5E-1E15-4DEB-B6FA-CC900968BC54/data/Containers/Bundle/Application/4A0EFEF9-4891-423E-A282-3762F2CE7C27/mocker-test.app/mocker-test
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/rogerluan/Library/Developer/CoreSimulator/Caches/dyld/20G95/com.apple.CoreSimulator.SimRuntime.iOS-14-5.18E182
DYLD_ROOT_PATH=/Applications/Xcode-12.5.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/rogerluan/Library/Developer/Xcode/DerivedData/mocker-test-fwqmiviyhgqgjwchhrbjsdsdxyeo/Build/Products/Debug-iphonesimulator:/Applications/Xcode-12.5.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Applications/Xcode-12.5.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode-12.5.app/Contents/Developer/Platforms/iPhoneOS.platfor
(lldb) 

@BasThomas
Copy link
Contributor

d'oh. I see. Just pasted the version 2.20 from the README; I guess we should update that as well. Will try again!

@BasThomas
Copy link
Contributor

Trying this again...

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'MyCoolProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  pod 'Mocker', '~> 2.5.2'

  # Pods for MyCoolProject

  target 'MyCoolProjectTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'MyCoolProjectUITests' do
    # Pods for testing
  end

end

Output

bas@Bas-iMac MyCoolProject % pod install
Analyzing dependencies
Downloading dependencies
Installing Mocker (2.5.2)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `MyCoolProject.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

[!] Automatically assigning platform `iOS` with version `14.0` on target `MyCoolProject` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] The `MyCoolProjectUITests [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-MyCoolProject-MyCoolProjectUITests/Pods-MyCoolProject-MyCoolProjectUITests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `MyCoolProjectUITests [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-MyCoolProject-MyCoolProjectUITests/Pods-MyCoolProject-MyCoolProjectUITests.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] Your project does not explicitly specify the CocoaPods master specs repo. Since CDN is now used as the default, you may safely remove it from your repos directory via `pod repo remove master`. To suppress this warning please add `warn_for_unused_master_specs_repo => false` to your Podfile.

@BasThomas
Copy link
Contributor

OK, recreating this now. Looking into it.

@BasThomas
Copy link
Contributor

It's interesting how this runtime crash occurs even when nothing has been imported related to Mocker.

@BasThomas
Copy link
Contributor

I think what we'd need to do is to weak-link XCTest. Let me put up a pull request. This will require a new release, though.

@BasThomas
Copy link
Contributor

BasThomas commented Aug 25, 2021

... or maybe that's not the full fix. Womp womp

This does seem to work after all!

AvdLee pushed a commit that referenced this issue Aug 26, 2021
Resolves #94

Not requiring this weakly means it'll attempt to load on every run; but XCTest will not be available when running the application directly.
@wetransferplatform
Copy link
Collaborator

The pull request #102 that closed this issue was merged and released as part of Release 2.5.4 🚀
Please let us know if the functionality works as expected as a reply here. If it does not, please open a new issue. Thanks!

Generated by GitBuddy

@BasThomas
Copy link
Contributor

Little does the bot know that the CocoaPods release itself isn't exactly out yet, but 😛

@AvdLee
Copy link
Contributor

AvdLee commented Aug 30, 2021

Little does the bot know that the CocoaPods release itself isn't exactly out yet, but 😛

It should! CI pushes the release to the CocoaPods branch too

@BasThomas
Copy link
Contributor

oh wow! 😀

@BasThomas
Copy link
Contributor

Hm, 2.5.2 is the latest available on CocoaPods https://github.com/CocoaPods/Specs/tree/master/Specs/2/a/c/Mocker

@BasThomas
Copy link
Contributor

So perhaps the bot needs a visit to the doctor. 😛

@AvdLee
Copy link
Contributor

AvdLee commented Aug 30, 2021

The bot is not drunk, just a bit shy to tell us!

image

[07:55:57]: ----------------------------------
[07:55:57]: --- Step: version_bump_podspec ---
[07:55:57]: ----------------------------------
[07:55:57]: ----------------------
[07:55:57]: --- Step: pod_push ---
[07:55:57]: ----------------------
[07:55:57]: $ pod trunk push
[07:55:59]: ▸ 
[07:55:59]: ▸ [!] Found podspec `Mocker.podspec`
[07:56:01]: ▸ Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
[07:56:01]: ▸ CocoaPods 1.11.0.rc.1 is available.
[07:56:01]: ▸ To update use: `gem install cocoapods --pre`
[07:56:01]: ▸ [!] This is a test version we'd love you to try.
[07:56:01]: ▸ For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.0.rc.1
[07:56:01]: ▸ Updating spec repo `trunk`
[07:56:01]: ▸ CocoaPods 1.11.0.rc.1 is available.
[07:56:01]: ▸ To update use: `gem install cocoapods --pre`
[07:56:01]: ▸ [!] This is a test version we'd love you to try.
[07:56:01]: ▸ For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.0.rc.1
[07:56:01]: ▸ Validating podspec
[07:56:58]: ▸  -> Mocker (2.5.4)
[07:56:58]: ▸ - NOTE  | xcodebuild:  note: Using new build system
[07:56:58]: ▸ - NOTE  | xcodebuild:  note: Building targets in parallel
[07:56:58]: ▸ - NOTE  | xcodebuild:  note: Using codesigning identity override: -
[07:56:58]: ▸ - NOTE  | [iOS] xcodebuild:  note: Planning build
[07:56:58]: ▸ - NOTE  | [iOS] xcodebuild:  note: Constructing build description
[07:56:58]: ▸ - NOTE  | [iOS] xcodebuild:  warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the App editor. (in target 'App' from project 'App')
[07:56:58]: ▸ - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
[07:56:58]: ▸ [!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.
[07:56:58]: Pod push failed: Exit status of command 'pod trunk push' was 1 instead of 0.

We need to update the pods token is what I see.

However, let's wait till we conclude here: https://twitter.com/twannl/status/1432253926657626113

@wetransferplatform
Copy link
Collaborator

The pull request #102 that closed this issue was merged and released as part of Release 2.5.4 🚀
Please let us know if the functionality works as expected as a reply here. If it does not, please open a new issue. Thanks!

Generated by GitBuddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants