unable to integrate One-Signal Push notification i

2019-07-31 14:28发布

问题:

i have tried to integrate One-signal as per given documents on their site but when i install framwork through podfile , at this time i got 0 percent dependancy

so how to integrate proper way??? in ios Xcode 8.

i have tried this Steps:

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:

I have noticed that the cocoaPods fails with iOS. I recommend doing the manual way.

  1. Download the sdk from here:

https://github.com/OneSignal/OneSignal-iOS-SDK

  1. Import the oneSignal.h and .m into your project.
  2. Remember to go to capabilities and activate Remote notifications
  3. Add this lines of code in your AppDelegate or wherever you would like to activate push notifications (Replace with your credentials):

    self.oneSignal = [[OneSignal alloc] initWithLaunchOptions:launchOptions
                                        appId:@"YOUR APP ID IN HERE"
                                        handleNotification:nil];
    
  4. Finally follow my question and you are ready to go. Good Luck! https://stackoverflow.com/a/39135807/2551707