React-native-onesignal: libRCTOneSignal.aが見つかりません

作成日 2018年08月16日  ·  26コメント  ·  ソース: OneSignal/react-native-onesignal

説明:
ここからReactNativeSDKの手順に従いました-https ://documentation.onesignal.com/docs/react-native-sdk-setup

npmパッケージを追加し、 react-native linkpod install 。 すべてが順調に進みました。

次に、通知拡張機能の作成に進みます。 Link Binary with Libararies設定にlibRCTOneSignal.aを追加するように指示された部分に到達すると、Xcodeが表示するリストでそれを見つけることができません。 One Signalを検索すると、次のように表示されます。

screen shot 2018-08-16 at 12 55 02 pm

これが私のヘッダー検索ページの設定です:
screen shot 2018-08-16 at 12 55 26 pm

libreact-native-onesignal.a追加しようとしましたが、ビルド時に次のリンクエラーが発生します。

ld: library not found for -lreact-native-onesignal
clang: error: linker command failed with exit code 1 (use -v to see invocation)

環境

  1. react-native-one-signal- 3.2.6
  2. RN- 0.55.4
  3. Xcode- 9.2
Help Wanted dependencies iOS

最も参考になるコメント

react-native linkが通常どおり正しく機能しなかったことが判明:DIはRCTOneSignalプロジェクトをLibrariesに手動で追加するだけで、 libRCTOneSignal.aを追加できました

react-native linkに加えて、手動でリンクするための手順を追加して、リンクが正しく機能したかどうかを確認できると便利だと思います:)

全てのコメント26件

react-native linkが通常どおり正しく機能しなかったことが判明:DIはRCTOneSignalプロジェクトをLibrariesに手動で追加するだけで、 libRCTOneSignal.aを追加できました

react-native linkに加えて、手動でリンクするための手順を追加して、リンクが正しく機能したかどうかを確認できると便利だと思います:)

どのように追加しましたか?

また、RCTOneSignalプロジェクトをライブラリに追加する方法を正確に理解しようとしています

@nickyhajal @ abdul-elah-js @steverob誰かがRCTOneSignalプロジェクトをLibrariesに手動で追加する方法を説明できますか?

この問題はドキュメントにもあるはずです。

@pacozaaここでFacebookの指示に従うことができます: https//facebook.github.io/react-native/docs/linking-libraries-ios

node_modules / react-native-onesignal / iosを開き、RCTOneSignal.xcodeprojをXCodeプロジェクトフォルダーLibrariesにドラッグアンドドロップすると、libRCTOneSignal.aが検索に表示されます。

screenshot at nov 30 16-21-30

これを反映するために、React-Nativeセットアップのドキュメントを更新しました。 これを取り上げて、ドキュメントの改善にご協力いただきありがとうございます。

ライブラリフォルダはありません。

@rgomezp申し訳ありませんが、問題を再開して

@MrAlekhin
iosディレクトリに移動して、 pod deintegrate && pod installを実行してみてください

これはXcode12で発生しています。ポッドを使用していません。

ハウディ、
これは、Xcode 12を使用していて、Cocoapodsを使用していない方にとっては問題のようです。

この問題を追跡するために再開します。

同じ問題のあるポッドを使用せずにXcode12を使用する別の方法。 :(

libをポッドに移動する必要がありましたが、ステージングターゲットで機能していません😢みんな、できるだけ早く確認してください🙏

@rgomezp申し訳ありませんが、それに関する更新はありますか? cocoapodsを使おうとしましたが、何らかの理由でOneSignalが初期化されていません。 React Native0.59を使用

react-native-onesignal問題があります。 ポッドの例は次のとおりです。

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



target 'example' do
  # Comment the next line if you don't want to use dynamic frameworks
  # Pods for example
  pod 'Branch', '0.28.1'
  pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
  pod 'React', :path => '../node_modules/react-native/'
end

target 'exampleDev' do
  # Comment the next line if you don't want to use dynamic frameworks
  # Pods for exampleDev
  pod 'Branch', '0.28.1'
  pod 'React', :path => '../node_modules/react-native/'
  pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
end

target 'OneSignalNotificationServiceExtension' do
  # Comment the next line if you don't want to use dynamic frameworks
  pod 'OneSignal', '>= 2.14.2', '< 3.0'
  # Pods for OneSignalNotificationServiceExtension
end

target 'DevOneSignalNotificationServiceExtension' do
  # Comment the next line if you don't want to use dynamic frameworks
  pod 'OneSignal', '>= 2.14.2', '< 3.0'
  # Pods for DevOneSignalNotificationServiceExtension
end

@rgomezpはこれを調べている人はいますか?

私たちのプロジェクトはreact-native0.59(cocoapodsなし)を使用していますが、ここでの問題のためにXCode12上に構築されていません

@rgomezpはこれを調べている人はいますか?

私たちのプロジェクトはreact-native0.59(cocoapodsなし)を使用していますが、ここでの問題のためにXCode12上に構築されていません

こっちも一緒。 最後の更新後のreact-native0.59およびXcode12には、説明されているエラーがあります。 更新前はすべて正常に機能しています。 私はreact-native-onesignal3.9.2を削除して再インストールしました

clang: error: no such file or directory: '/Users/leonardo/Library/Developer/Xcode/DerivedData/xxxxx/Build/Products/Debug-iphonesimulator/libRCTOneSignal.a' Command Ld failed with a nonzero exit code

image

アップデート1:
本番用にアプリをビルドすると機能します...問題は、シミュレーターで実行しようとしたときです(すべて異なるiOSで)

アップデート2:
物理デバイスでもデバッグできます。

アップデート3:
デバッグはできますが、onesignalはユーザーの同意を求めないため、通知が機能しません。 最新バージョン3.9.2も更新しました。

私にとっての解決策は、xcodeを11.7にダウングレードし、iosフォルダーのバックアップを使用することでした。 問題はxcode12 +に関連しているようです

@Tebrynnが言ったように、XCodeをダウングレードしようとしましたが、同じ問題が引き続き発生します。
私にとって唯一の解決策は、手動インストールをCocoapodsインストールに置き換えることでした。
ドキュメント(https://documentation.onesignal.com/docs/react-native-sdk-setup)の指示に従いました。

これに対する解決策はありますか?

Xcode12にアップデートしたところ、ビルド時にもこのエラーが発生しました。

最近Xcode12にアップデートしました。libRCTOneSignal.aが見つからない場合にも同じ問題が発生します。 私は他の人が試した手順と回避策に従ったと思います。 私は困惑しています。
OneSignalでarm64を除外することに関するいくつかの記事を読みました。 今のところ運が悪かったので試してみました。 ただし、シミュレーターにのみ影響するため、この問題にこれ以上時間を費やすことはおそらくないでしょう。

同じ問題、Xcode12.4およびRN0.59.10。

ここで同じ問題。

ハウディ、
手動インストールがどういうわけか壊れたようです。 調査するにはさらに掘り下げる必要があります。

お待ち頂きまして、ありがとうございます。

それまでの間、可能であれば、Cocoapodsのインストール方法に切り替えてみてください

私は同じ問題に直面しています。 解決策はありますか?

こんにちは、React-Native-OneSignalバージョン4.0.0の時点では、RCTOneSignal.xcodeprojに含まれるバイナリは更新されていません。つまり、Cocoapodsを使用してOneSignalをNotificationServiceExtensionに追加する必要があります。
これを行うには、Podfileに以下を追加します。

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 3.0', '< 4.0'
end

次に、Swiftを使用している場合は、NotificationServiceファイルを次のように更新します。

import UserNotifications

import OneSignal

class NotificationService: UNNotificationServiceExtension {

    var contentHandler: ((UNNotificationContent) -> Void)?
    var receivedRequest: UNNotificationRequest!
    var bestAttemptContent: UNMutableNotificationContent?

    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: <strong i="10">@escaping</strong> (UNNotificationContent) -> Void) {
        self.receivedRequest = request;
        self.contentHandler = contentHandler
        bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

        if let bestAttemptContent = bestAttemptContent {
            OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: self.bestAttemptContent)
            contentHandler(bestAttemptContent)
        }
    }

    override func serviceExtensionTimeWillExpire() {
        // Called just before the extension will be terminated by the system.
        // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
        if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {
            OneSignal.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
            contentHandler(bestAttemptContent)
        }
    }

}

または、Objective-Cを使用している場合は次のようになります

#import <OneSignal/OneSignal.h>

#import "NotificationService.h"

<strong i="14">@interface</strong> NotificationService ()

<strong i="15">@property</strong> (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
<strong i="16">@property</strong> (nonatomic, strong) UNNotificationRequest *receivedRequest;
<strong i="17">@property</strong> (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;

<strong i="18">@end</strong>

<strong i="19">@implementation</strong> NotificationService

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.receivedRequest = request;
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];

    [OneSignal didReceiveNotificationExtensionRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];

    // DEBUGGING: Uncomment the 2 lines below and comment out the one above to ensure this extension is excuting
    //            Note, this extension only runs when mutable-content is set
    //            Setting an attachment or action buttons automatically adds this
    // NSLog(@"Running NotificationServiceExtension");
    // self.bestAttemptContent.body = [@"[Modified] " stringByAppendingString:self.bestAttemptContent.body];

    self.contentHandler(self.bestAttemptContent);
}

- (void)serviceExtensionTimeWillExpire {
    // Called just before the extension will be terminated by the system.
    // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.

    [OneSignal serviceExtensionTimeWillExpireRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];

    self.contentHandler(self.bestAttemptContent);
}

<strong i="20">@end</strong>

完全なセットアップガイドはここにあります

このページは役に立ちましたか?
0 / 5 - 0 評価