swiftcocoapodsanalyticssegment-io

'sharedApplication' is unavailable: not available on iOS (App Extension) for Segmentio/Analytics Pod


Running Xcode version 8.2.1, Swift 3, and Cocoapods version 1.1.1 and I can't for the life of me figure out how to resolve this issue. I need to use the analytics library but can't get past this error in the UIViewController+SEGScreen.m class: enter image description here

Without forking, is there another solution here?


Solution

  • What exactly do you need to figure out? The API is not available when targeting iOS extensions. There is no solution but fixing the API. If this is an open source, the fix looks really simple (wrapping in a custom macro such #ifdef TARGET_EXTENSION). If not, time to use a properly written analytics framework, that takes into account all aspects of iOS development, not the most trivial ones only.