无法在ios中集成单信号推送通知

时间:2016-12-12 07:08:52

标签: push-notification apple-push-notifications onesignal

我试图在他们的网站上按照给定的文件整合One-signal但是当我通过podfile安装framwork时,此时我的0%依赖

那么如何整合正确的方法???在ios Xcode 8中。

我尝试过这个步骤:

Option A: Use CocoaPods (Recommended)

Setting up CocoaPods on your system if you don't have it already.

    Make sure you have the latest 1.1.0 version by running pod --version from the terminal.
    Run the following to upgrade sudo gem install cocoapods

1.1 Make sure your current Xcode project is closed.
1.2 Run pod init
1.3 Run echo "pod 'OneSignal'" >> Podfile
     NOTE (React Native only) : Run echo "pod 'OneSignal', '~> 1.13.3'" >> Podfile instead.
1.3 Run pod install
1.4 Open the newly created .xcworkspace file.

https://documentation.onesignal.com/docs/ios-sdk-setup

1 个答案:

答案 0 :(得分:1)

我注意到cocoaPods因iOS而失败。我建议采用手动方式。

  1. 从这里下载sdk:
  2. https://github.com/OneSignal/OneSignal-iOS-SDK

    1. 将oneSignal.h和.m导入您的项目。
    2. 请记住转到功能并激活远程通知
    3. 在AppDelegate或您想要激活推送通知的任何地方添加以下代码行(替换为您的凭据):

      self.oneSignal = [[OneSignal alloc] initWithLaunchOptions:launchOptions
                                          appId:@"YOUR APP ID IN HERE"
                                          handleNotification:nil];
      
    4. 最后按照我的问题,你准备好了。祝好运! https://stackoverflow.com/a/39135807/2551707