React-native-onesignal: No se puede encontrar libRCTOneSignal.a

Creado en 16 ago. 2018  ·  26Comentarios  ·  Fuente: OneSignal/react-native-onesignal

Descripción:
He seguido las instrucciones para React Native SDK desde aquí: https://documentation.onesignal.com/docs/react-native-sdk-setup

Agregué el paquete npm, realicé react-native link y también pod install . Todo salió bien.

Luego procedo a crear la Extensión de notificación. Cuando llego a la parte donde se me indica que agregue libRCTOneSignal.a en la configuración Link Binary with Libararies , no puedo encontrarlo en la lista que muestra Xcode. Esto es todo lo que veo cuando busco One Signal:

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

Aquí está la configuración de las páginas de búsqueda de mi encabezado:
screen shot 2018-08-16 at 12 55 26 pm

Ahora intenté agregar libreact-native-onesignal.a , pero al compilar obtengo este error de vinculación:

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

Medio ambiente

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

Comentario más útil

Resulta que react-native link no funcionó correctamente como de costumbre: DI solo tuvo que agregar manualmente el proyecto RCTOneSignal en Libraries y luego pude agregar libRCTOneSignal.a

Creo que sería bueno si ustedes pudieran agregar las instrucciones para vincular manualmente además de react-native link para que la gente pueda verificar si el vínculo funciona correctamente :)

Todos 26 comentarios

Resulta que react-native link no funcionó correctamente como de costumbre: DI solo tuvo que agregar manualmente el proyecto RCTOneSignal en Libraries y luego pude agregar libRCTOneSignal.a

Creo que sería bueno si ustedes pudieran agregar las instrucciones para vincular manualmente además de react-native link para que la gente pueda verificar si el vínculo funciona correctamente :)

como lo agregaste

También tratando de averiguar exactamente cómo agregar el proyecto RCTOneSignal a las bibliotecas

@nickyhajal @ abdul-elah-js @steverob ¿Alguien puede explicar cómo agregar manualmente el proyecto RCTOneSignal en Libraries ?

Este problema también debería estar en la documentación.

@pacozaa puede seguir las instrucciones de Facebook aquí: https://facebook.github.io/react-native/docs/linking-libraries-ios

Abra node_modules / react-native-onesignal / ios, luego arrastre y suelte RCTOneSignal.xcodeproj a la carpeta del proyecto XCode Libraries, luego la libRCTOneSignal.a aparecerá en la búsqueda.

screenshot at nov 30 16-21-30

He actualizado la documentación en la configuración de React-Native para reflejar esto. ¡Gracias por mencionar este tema y ayudarnos a mejorar nuestra documentación!

No hay carpeta de bibliotecas.

@rgomezp Lo siento, ¿podría volver a abrir el problema? libRCTOneSignal.a no se puede encontrar en la extensión en Xcode 12. Pero funciona en Xcode 11.7

@MrAlekhin ,
Intente ingresar al directorio ios y ejecutar pod deintegrate && pod install

Esto me está sucediendo en Xcode 12. No uso de pods.

Hola,
Parece que esto es un problema para aquellos de ustedes que usan Xcode 12 y _no_ usan Cocoapods.

Reapertura para realizar un seguimiento de este problema.

Otro que usa Xcode 12 sin usar pods que tienen el mismo problema. :(

Tuve que mover la biblioteca a los pods, pero no funciona en mi objetivo de preparación😢 chicos, revisen eso lo antes posible 🙏

@rgomezp lo siento, ¿alguna actualización sobre eso? Intenté usar cocoapods pero OneSignal no se inicializó por alguna razón. usando React Native 0.59

Tener problemas con react-native-onesignal . Aquí está el ejemplo de Pod:

# 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, ¿alguien está investigando esto?

Nuestro proyecto usa react-native 0.59 (sin cocoapods) y no se basa en XCode 12 debido al problema aquí

@rgomezp, ¿alguien está investigando esto?

Nuestro proyecto usa react-native 0.59 (sin cocoapods) y no se basa en XCode 12 debido al problema aquí

Aquí igual. react-native 0.59 y Xcode 12 después de la última actualización tengo el error descrito. Todo funciona bien antes de la actualización. Incluso eliminé y reinstalé react-native-onesignal 3.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

Actualización 1:
Si construyo la aplicación para producción, funciona ... El problema es cuando trato de ejecutar en el simulador (todos ellos con diferentes iOS)

Actualización 2:
Puedo depurar incluso en un dispositivo físico.

Actualización 3:
Puedo depurar pero una señal no solicita el consentimiento del usuario, por lo que las notificaciones no funcionan. Incluso actualicé la última versión 3.9.2.

La solución para mí fue degradar xcode a 11.7 y usar una copia de seguridad de la carpeta ios. El problema parece estar relacionado con xcode 12+

Traté de degradar el XCode, como dijo @Tebrynn , pero sigo teniendo el mismo problema.
Para mí, la única solución fue reemplazar la instalación manual con la instalación de Cocoapods.
Simplemente seguí las instrucciones en la documentación (https://documentation.onesignal.com/docs/react-native-sdk-setup).

¿Alguna solución para esto?

Acabo de actualizar a Xcode12 y también estoy enfrentando este error en la compilación.

Recientemente actualicé a Xcode 12. Tengo el mismo problema al no encontrar libRCTOneSignal.a. Creo que seguí los pasos y las soluciones alternativas que otros han intentado. Estoy perplejo.
Leí varios artículos sobre la exclusión de arm64 para OneSignal. Probé estos sin suerte hasta ahora. Sin embargo, dado que solo afecta al simulador, probablemente no dedicaré mucho más tiempo a este tema.

Mismo problema, Xcode 12.4 y RN 0.59.10.

El mismo problema aquí.

Hola,
Parece que las instalaciones manuales se rompieron de alguna manera. Tendremos que profundizar más para investigar.

Gracias por su paciencia.

Mientras tanto, si es posible, intente cambiar a un método de instalación de Cocoapods

Estoy enfrentando el mismo problema. ¿Alguna solución?

Hola, a partir de la versión 4.0.0 de React-Native-OneSignal, el binario contenido en RCTOneSignal.xcodeproj no se actualizará, lo que significa que deberá usar Cocoapods para agregar OneSignal a NotificationServiceExtension.
Puede hacerlo agregando lo siguiente a su Podfile:

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

Luego actualice el archivo NotificationService a lo siguiente si está usando Swift

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)
        }
    }

}

O lo siguiente si está utilizando 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>

La guía de configuración completa se puede encontrar aquí

¿Fue útil esta página
0 / 5 - 0 calificaciones