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

Autolinking (pod install) should work out of the box in RN > 0.60 #12

Open
mattslight opened this issue Sep 24, 2019 · 8 comments
Open

Comments

@mattslight
Copy link

Trying to upgrade to RN 0.60.5 and it now uses (and recommends) CocoaPods by default.

I get the the following error when running pod install

Should be an easy fix, although I am not sure why Cocoapods would fail due to an unset homepage...

[!] The `RNReactNativeReplaykit` pod failed to validate due to 1 error:
    - ERROR | attributes: Missing required attribute `homepage`.
    - WARN  | source: The version should be included in the Git tag.
    - WARN  | description: The description is equal to the summary.
@code-matt
Copy link
Owner

code-matt commented Sep 29, 2019

I have been trying to install it in a fresh 61.1 app for a few hours

After getting past a lot of issues which boiled down to needing to add the following to the podspec.

  s.preserve_path = "${POD_ROOT}/RNReactNativeReplaykit/RNReactNativeReplaykit-Bridging-Header.h"
  s.xcconfig = { 'SWIFT_OBJC_BRIDGING_HEADER' => '${POD_ROOT}/RNReactNativeReplaykit/RNReactNativeReplaykit-Bridging-Header.h' }

I ended up with this error I am not sure can be bypassed.
Screen Shot 2019-09-28 at 5 14 23 PM

I am not sure Swift can be in modules any more and work with autolinking. I tried react-native link first (after removing the podspec), that did not work. I tried the old manual install process after that. Since React is no longer a target in the main project but now in a pod, so that does not seem to work either.

Sad too because Apple finally fixed ReplayKit !

@mattslight
Copy link
Author

Have you got use frameworks in the Podfile? Commenting out that line helped for me. If it helps I have a bridge.swift:

//
//  bridge.swift

import Foundation

And an empty Project-Bridging-Header.h

@code-matt
Copy link
Owner

@mattslight I came across the first article last night but it seems outdated and options are gone that it mentions. The second I just gave a try, with no luck.

Can you try in fresh 61.1 project ? By default use_frameworks is not there any more in the Podfile. I think the new process where pods get added by scanning node_modules turns it on by default not.

  • init a 61.1 project
  • add following to package.json "react-native-replaykit": "github:code-matt/react-native-replaykit#feature/autolinking"
  • npm install
  • cd into ios and run pod install

Open the .xcworkspace and try and build. If you want to play with the podspec, you can delete pods folder and change it in node_modules and run pod install again. If you do have it working, can you please open a PR to that branch ?

@mattslight
Copy link
Author

I will try and let you know

@mattslight
Copy link
Author

mattslight commented Sep 30, 2019

@code-matt I tried and the issue I get is "RNReactNativeReplayKit-Swift.h" not found.

I am not too familiar with Swift and bridging, but wonder if the following is relevant?

https://stackoverflow.com/questions/52891836/myprojectname-swift-h-not-found-after-clean-build

Edit: It is possible to coax Xcode to build, but only by taking additional post-install steps. I take it you are trying to get autolinking working "out of the box".

@code-matt
Copy link
Owner

code-matt commented Sep 30, 2019

Yeah :/ was trying to make autolinking work out of the box. The reason it's not found is because the bridging header and setting not making it over to the pod.

That is what adding, the following is for. To try and force xcode to generate the -Swift file. But the error produced by doing this is pretty final. ( in screenshot above )

  s.preserve_path = "${POD_ROOT}/RNReactNativeReplaykit/RNReactNativeReplaykit-Bridging-Header.h"
  s.xcconfig = { 'SWIFT_OBJC_BRIDGING_HEADER' => '${POD_ROOT}/RNReactNativeReplaykit/RNReactNativeReplaykit-Bridging-Header.h' }

I think even with manual linking steps, asking the users to add React back to their main app as a target would be too much. Since it's all in pods now.

@mattslight
Copy link
Author

mattslight commented Oct 1, 2019

Do you have the documentation from the React Native team on how to set up autolinking?

Also is there a doc from Cocoapods on setting up a pod with Swift support?

@mattslight mattslight changed the title The RNReactNativeReplaykit pod failed to validate due to 1 error: Autolinking (pod install) should work out of the box in RN > 0.60 Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants