实现者通知将iOS推送到React Native

Sigo trabajando con React Native发行并发行了一份新的文档,介绍了iOS上的通知。 Espero sirva de ayuda ya es unaguíacon los pasos que he se seguido hasta tenerlas funcionando。 ¡Comencemos!

简介

凡事互助的基本法令,在没有通知的情况下即可进行,包括:

Comopodéisver aparecen 4个元素:

  • Elprovedor de notificaciones, es decir和nuestro 后端。
  • 苹果公司的 APN声明, Apple毛绒通知服务声明和服务证明了Apple的确凿通知书和los Dissarrolladores Para Enviar通知书。
  • El Dispositivo iOS Asociado
  • 是的,请在新的通知后再使用。

Para que todo este“ chiringuito” funcione son necesarios los siguientes pasos:

  • 证明人的普遍使用情况
  • 不可更改的通知书,请按以下说明发送通知:APN的唯一身份证明书,以相同的身份在任何后端分发了通知书。

El proceso es algo类似于esto:

帕索1.Aplicaciónmóvil

图书馆信息库: React Native Push Notification

zo0r / react-native-push-notification
反应本机本地和远程通知。 通过创建…… github.com 为zo0r / react-native-push-notification开发做出贡献

Sí,tambiénemplear el paquete PushNotificationIOS de React Native que Ya viene listo para ser usado pero estalibreríanos da laopciónde mandartambiénnotificaciones locale de forma bastante sencilla y es al al que en mi caso necesito。

从头至尾,世博会会ejected修正案。

图书馆,在iOS上的配置文件,在PushNotificationIOS上的PushNotificationIOS ,以及在以下位置显示的信息:

  1. Abriremos XCodeLibraries共享Libraries node_modules node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproject

2.链接到目标 Link Binary with libraries文件的最新构建libRCTPushNotification

3.完整档案AppDelegate.m comienzo lo siguiente:

  #import  

如果您不连续地完成FinishLaunchingWithOptions的操作,则ObjectiveC通过其他方式通知响应者:

  -( void )application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { 
  [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings]; 
  } 
  //注册事件所需。 
  -( void )application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
  [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; 
  } 
  //通知事件必需。  您必须在处理远程通知后调用完成处理程序。 
  -( void )应用程序:(UIApplication *)应用程序didReceiveRemoteNotification:(NSDictionary *)userInfo 
  fetchCompletionHandler :( void (^)(UIBackgroundFetchResult))completionHandler { 
  [RCTPushNotificationManager didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; 
  } 
  //对于registrationError事件是必需的。 
  -( void )application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { 
  [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error]; 
  } 
  //对于localNotification事件是必需的。 
  -( void )application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { 
  [RCTPushNotificationManager didReceiveLocalNotification:notification]; 
  } 
  //当通知传递到前台应用程序时调用。 
  -( void )userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)Notification withCompletionHandler :( void (^)(UNNotificationPresentationOptions options))completionHandler { 
  completeHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge); 
  } 

4. Habilitaremos las notificaciones 推动您的通讯录获得相应的Capabilities

5.使用finalmenteañadiremos(por fin)并在应用程序中使用JavaScript。

 从'react-native'导入{PushNotificationIOS}; 
 从'react-native-push-notification'导入PushNotification; 
 导出默认的onRegister => 
  PushNotification.configure({ 
  onRegister:令牌=> onRegister(令牌), 
  onNotification:通知=> { 
  notification.finish(PushNotificationIOS.FetchResult.NoData); 
  }, 
 权限:{ 
 警告:是的, 
 徽章:是的, 
 声音:真实 
  }, 
  popInitialNotification:正确, 
  requestPermissions:正确 
  }); 
  //在某个地方 
  initNotifications(); 

使用通知的方式可轻松地处理所有重要事件,并且可以在任何其他地方使用JavaScript 。 洛斯梅多多斯校长之子:

  • onRegister后端注册的通知书,请在后端发送通知。
  • onNotification ,可根据要求在任何情况下都可在las acciones处确认queramos al recibir。

即时通知的配置通知书的发布地点initNotifications

  PushNotification.localNotificationSchedule({ 
 标题:“ title”, 
 消息:“消息”, 
  playSound:是的, 
 日期:新的Date(Date.now()+ 5 * 1000) 
  }); 

继续使用新的配置文件。 Vamos ahora是一个服务对象。

Paso 2. Servidor

在iTunes Connect中进行入门和建议阅读:

应用程序编号desarrolladores

应用程序ID配置包和应用程序捆绑包 :https://developer.apple.com/account/ios/identifier/bundle/create

重要提示。 Bundle ID销售商证明书,证明没有问题。 XCode en lasecciónTargets con el querellenéisaquí的广告。

诺塔 Xu y yyáyáháyáhácreado por vosotros asíque por si cas acaso mirad la lista de identificadores por si ue vestro bundle ya apareceahí

埃斯托(Hesto),埃斯托(esto),认证应用程序和应用程序应用程序Edit

连续性下降通知必须按原产地规则进行。 产品销售Production SSL Certificate

Esto nospedirácrear un 证书签名请求连续请求

埃斯托(Hecho esto),完整证明书, 证明书和完整证明书。

洛斯APN俱乐部的Geneclaiónde claclaves deautenticación

Con fin de poder enviar通知可推动 Apple APN的Sercons neconario con con con con con un conclave de autentdicemostambiéndes de el Portal desarrollo de Apple:https://developer.apple.com/account/ios/authkey/

Apple Play 通知Apple Push Notifications服务。 保存.p8 .p8保留原始保护区的条文。

通知书的发布者监护人阿德玛斯,通知书的发布者。

决赛, Team Id合作。

Es decir,埃莱斯特州埃斯特角大区:

  • UN Archivo P8 CON EN certificado para enviar notificaciones push atravéscde los APN’s
  • 身份证明书
  • Nuestro Team Id

Enviando通知推送

互惠生。 可以从通用软件Symfony的后端获取信息,并可以通过任何方式从通用到通用的通知。

没有明显的问题,可以使用以下任何一种方法:

https://github.com/ProductCrafters/react-native-ios-push-notifications-example

档案库pushServer.js其他版本:

 节点pushServer.js keyId teamId令牌appId消息 

发行通知(代办PushNotifications登记PushNotifications通行证PushNotificationsPushNotifications

西拉阿科拉,西甲与西非的服务

重要提示。 可以通过HTTP2进行身份验证,也可以使用HTTP2进行身份验证。通过HTTP2可以访问HTTP Server的URL:通过HTTP2可以访问以下网址:

 sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev 
wget https://curl.haxx.se/download/curl-7.63.0.tar.gz
tar xzf curl-7.63.0.tar.gz
cd curl-7.63.0
./configure --with-nghttp2 --prefix=/usr/local --with-ssl
make && sudo make install
sudo ldconfig

是的,您可以通过一份服务来通知您:

  $ sendIOSPushNotification( 
  “令牌”, 
  'título', 
  “subtítulo”, 
  '门萨吉' 
  ); 

请您在我们的网站上查看您的Espa que os haya servido和cualquier duda lapodéisdejar!