Return-1
Return-1

Reputation: 2449

Manually adding Libraries on react-native ^60

Unsure where else to address this.

The autolinker feature is great, however, i've come across issues with adding libraries manually after rn ^60.

A good example would be the PushNotificationIOS library. In the past all that needed to be done was manually add it in the Libraries and tweak Build Phases a little. https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking

Doing the same process now won't build as the build system cant find the header paths. So the question is:

Is it the case that manually linking cant work like it used to anymore?

P.S: Another approach would have been to use the @react-native-community versionf of PushNotificationIOS but that seems to be problematic right now because of : https://github.com/react-native-community/react-native-push-notification-ios/issues/16

Upvotes: 1

Views: 586

Answers (1)

Freewalker
Freewalker

Reputation: 7335

Here's my upgrade path for 0.60.x with react-native-push-notification, worked after resolving several errors:

  1. Upgrade to latest: yarn add react-native-push-notification
  2. yarn add @react-native-community/push-notification-ios
  3. Ensure any references are removed from your Podfile (including commented references, or react-native will still complain)
  4. in Xcode, remove RNCPushNotification from General -> Linked Frameworks
  5. Remove previous PushNotification code from AppDelegate.m
  6. react-native link @react-native-community/push-notification-ios
  7. If this didn't add code in AppDelegate.m (it didn't in my case) then manually add the code from their GitHub page

One more gotcha - when testing that it works, make sure your app is closed or a local notification won't fire.

The process above resolved all my errors. Hope it works for you!

Upvotes: 1

Related Questions