OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
494 stars 263 forks source link

Documentation Update Please (CocoaPods) #168

Closed mitchellkrogza closed 7 years ago

mitchellkrogza commented 7 years ago

I followed your guide to setting up CocoaPods but continually ran into errors when running pod install "[!] The dependency OneSignal is not used in any concrete target." and "[!] Unable to find a target named OneSignal, did find ."

Instructions for creating a project seem non-existent so I tried your example app in this repo which gets me now able to use your cocoapods install directions which creates the .xcworkspace file

Now I am a bit closer but I am having major problems renaming the app and changing settings, just cannot figure this one out ??

I get these errors:

None of your accounts are a member of '99SW8E36CT':  An unexpected error occurred. Xcode cannot find a team matching '99SW8E36CT'.
No profiles for 'com.onesignal.example.OSContentExension' were found:  Xcode couldn't find a provisioning profile matching 'com.onesignal.example.OSContentExension'.
Code signing is required for product type 'App Extension' in SDK 'iOS 10.2'

I did search in the project for 99SW8E36CT and changed it to my Team Name but it does not seem to stick ..... also the other 2 errors have me stuck.

Now I got past the above errors but when I click play I get the following long list of errors ??? This truly seems like rocket science getting iOS push notifications to work.

Ld /Users/xxx/Library/Developer/Xcode/DerivedData/OneSignalxxx-heugnotninubmzdmrtnxbpfqjxbt/Build/Products/Debug-iphoneos/OSServiceExtension.appex/OSServiceExtension normal arm64
    cd /Users/xxx/Documents/XCODE/OneSignalExample
    export IPHONEOS_DEPLOYMENT_TARGET=10.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -L/Users/xxx/Library/Developer/Xcode/DerivedData/OneSignalxxx-heugnotninubmzdmrtnxbpfqjxbt/Build/Products/Debug-iphoneos -F/Users/xxx/Library/Developer/Xcode/DerivedData/OneSignalxxx-heugnotninubmzdmrtnxbpfqjxbt/Build/Products/Debug-iphoneos -F/Users/xxx/Documents/XCODE/OneSignalExample/Pods/OneSignal/iOS_SDK/Framework -filelist /Users/xxx/Library/Developer/Xcode/DerivedData/OneSignalxxx-heugnotninubmzdmrtnxbpfqjxbt/Build/Intermediates/OneSignalxxx.build/Debug-iphoneos/OSServiceExtension.build/Objects-normal/arm64/OSServiceExtension.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/../../Frameworks -miphoneos-version-min=10.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/xxx/Library/Developer/Xcode/DerivedData/OneSignalxxx-heugnotninubmzdmrtnxbpfqjxbt/Build/Intermediates/OneSignalxxx.build/Debug-iphoneos/OSServiceExtension.build/Objects-normal/arm64/OSServiceExtension_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -fapplication-extension -ObjC -ObjC -framework OneSignal -framework SystemConfiguration -e _NSExtensionMain -lPods-OSServiceExtension -Xlinker -dependency_info -Xlinker /Users/xxx/Library/Developer/Xcode/DerivedData/OneSignalxxx-heugnotninubmzdmrtnxbpfqjxbt/Build/Intermediates/OneSignalxxx.build/Debug-iphoneos/OSServiceExtension.build/Objects-normal/arm64/OSServiceExtension_dependency_info.dat -o /Users/xxx/Library/Developer/Xcode/DerivedData/OneSignalxxx-heugnotninubmzdmrtnxbpfqjxbt/Build/Products/Debug-iphoneos/OSServiceExtension.appex/OSServiceExtension

Undefined symbols for architecture arm64:
  "_UIUserNotificationActionResponseTypedTextKey", referenced from:
      +[swizzleUNUserNotif callLegacyAppDeletegateSelector:isTextReply:actionIdentifier:userText:fromPresentNotification:withCompletionHandler:] in OneSignal(UNUserNotificationCenter+OneSignal.o)
  "_OBJC_CLASS_$_UIAlertView", referenced from:
      objc-class-ref in OneSignal(OneSignal.o)
  "_UIApplicationLaunchOptionsRemoteNotificationKey", referenced from:
      +[OneSignal initWithLaunchOptions:appId:handleNotificationReceived:handleNotificationAction:settings:] in OneSignal(OneSignal.o)
  "_OBJC_METACLASS_$_UIViewController", referenced from:
      _OBJC_METACLASS_$_OneSignalWebView in OneSignal(OneSignalWebView.o)
  "_OBJC_CLASS_$_UINavigationController", referenced from:
      objc-class-ref in OneSignal(OneSignalWebView.o)
  "_OBJC_CLASS_$_UIBarButtonItem", referenced from:
      objc-class-ref in OneSignal(OneSignalWebView.o)
  "_OBJC_CLASS_$_UIViewController", referenced from:
      objc-class-ref in OneSignal(OneSignalWebView.o)
      _OBJC_CLASS_$_OneSignalWebView in OneSignal(OneSignalWebView.o)
  "_OBJC_CLASS_$_UIColor", referenced from:
      objc-class-ref in OneSignal(OneSignalWebView.o)
  "_OBJC_CLASS_$_UIWebView", referenced from:
      objc-class-ref in OneSignal(OneSignalWebView.o)
  "_UILocalNotificationDefaultSoundName", referenced from:
      +[OneSignalHelper prepareUILocalNotification::] in OneSignal(OneSignalHelper.o)
  "_UIBackgroundTaskInvalid", referenced from:
      +[OneSignalHelper endBackgroundMediaTask] in OneSignal(OneSignalHelper.o)
      +[OneSignalTracker endBackgroundFocusTask] in OneSignal(OneSignalTracker.o)
      +[OneSignalLocation endTask] in OneSignal(OneSignalLocation.o)
  "_OBJC_CLASS_$_UIDevice", referenced from:
      objc-class-ref in OneSignal(OneSignalHelper.o)
      objc-class-ref in OneSignal(OneSignal.o)
      objc-class-ref in OneSignal(OneSignalLocation.o)
  "_OBJC_CLASS_$_UIActivityIndicatorView", referenced from:
      objc-class-ref in OneSignal(OneSignalWebView.o)
  "_OBJC_CLASS_$_UILocalNotification", referenced from:
      objc-class-ref in OneSignal(OneSignalHelper.o)
  "_OBJC_CLASS_$_UIApplication", referenced from:
      objc-class-ref in OneSignal(UIApplicationDelegate+OneSignal.o)
      objc-class-ref in OneSignal(OneSignalHelper.o)
      objc-class-ref in OneSignal(OneSignalWebView.o)
      objc-class-ref in OneSignal(OneSignalTracker.o)
      objc-class-ref in OneSignal(OneSignal.o)
      l_OBJC_$_CATEGORY_UIApplication_$_OneSignal in OneSignal(OneSignal.o)
      objc-class-ref in OneSignal(UNUserNotificationCenter+OneSignal.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

One step closer now. got past the 16 build errors by changing the Linking locations to $(inherited)

but now have one last error

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

and if I run pod install now I get this ??? What a pelava

[!] The `OneSignalxxx [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-OneSignalxxx/Pods-OneSignalxxx.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `OneSignalxxx [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-OneSignalxxx/Pods-OneSignalxxx.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
jkasten2 commented 7 years ago

@mitchellkrogza Our example project in this repo links to OneSignal.framework directly so you shouldn't use cocoapods on it. You just need to update the Bundle identifier and Team to your own under the General tab in Xcode. image

If you are testing with a new project or your own existing Xcode project you should be able to follow our normal setup guide you linked to. https://documentation.onesignal.com/docs/ios-sdk-setup

mitchellkrogza commented 7 years ago

Thanks for the explanation ;)

jkasten2 commented 7 years ago

@mitchellkrogza Feel free to reopen this thread if the above didn't resolve your issue.

mitchellkrogza commented 7 years ago

Thanks @jkasten2 this did explain it for me and cleared my confusion about Cocoapods. Thanks for your help.