Detect TestFlight?

后端 未结 3 1542
暖寄归人
暖寄归人 2020-12-10 03:14

I would prefer to use the same build configuration for TestFlight vs. App Store. Is there a way to detect at runtime whether the app has been installed via TestFlight or the

3条回答
  •  悲哀的现实
    2020-12-10 03:56

    To determine Debug, TestFlight or AppStore deployment in Swift:

      private static let isTestFlight = NSBundle.mainBundle().appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
    
      // This can be used to add debug statements.
      static var isDebug: Bool {
        #if DEBUG
          return true
        #else
          return false
        #endif
      }
    

    Complete source and sample: https://stackoverflow.com/a/33830605/639227

提交回复
热议问题