diff --git a/abtesting/ABTestingExample.xcodeproj/project.pbxproj b/abtesting/ABTestingExample.xcodeproj/project.pbxproj index aafb770a5..883bdad80 100644 --- a/abtesting/ABTestingExample.xcodeproj/project.pbxproj +++ b/abtesting/ABTestingExample.xcodeproj/project.pbxproj @@ -193,17 +193,18 @@ TargetAttributes = { 10B92C9B202E3603008DBD68 = { CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; TestTargetID = 8DFFBF991F9E6C5200C3483E; }; 8DFFBF991F9E6C5200C3483E = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 0930; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; }; 8DFFBFAD1F9E6C5200C3483E = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 0930; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; TestTargetID = 8DFFBF991F9E6C5200C3483E; }; @@ -336,7 +337,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.firebase.ABTestingExample.ABTestingExampleUITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = ABTestingExample; }; @@ -361,7 +362,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.firebase.ABTestingExample.ABTestingExampleUITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = ABTestingExample; }; @@ -487,8 +488,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(PODS_CONFIGURATION_BUILD_DIR)/GoogleToolboxForMac $(PODS_CONFIGURATION_BUILD_DIR)/nanopb $(PODS_CONFIGURATION_BUILD_DIR)/Protobuf"; PRODUCT_BUNDLE_IDENTIFIER = com.firebase.ABTestingExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -501,8 +501,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(PODS_CONFIGURATION_BUILD_DIR)/GoogleToolboxForMac $(PODS_CONFIGURATION_BUILD_DIR)/nanopb $(PODS_CONFIGURATION_BUILD_DIR)/Protobuf"; PRODUCT_BUNDLE_IDENTIFIER = com.firebase.ABTestingExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -515,8 +514,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.firebase.ABTestingExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ABTestingExample.app/ABTestingExample"; }; name = Debug; @@ -530,8 +528,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.firebase.ABTestingExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ABTestingExample.app/ABTestingExample"; }; name = Release; diff --git a/abtesting/ABTestingExample/AppDelegate.swift b/abtesting/ABTestingExample/AppDelegate.swift index a452d0846..50368108e 100644 --- a/abtesting/ABTestingExample/AppDelegate.swift +++ b/abtesting/ABTestingExample/AppDelegate.swift @@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure() return true } diff --git a/abtesting/ABTestingExample/ViewController.swift b/abtesting/ABTestingExample/ViewController.swift index a81b33f13..a6d5dccf2 100644 --- a/abtesting/ABTestingExample/ViewController.swift +++ b/abtesting/ABTestingExample/ViewController.swift @@ -87,8 +87,13 @@ class ViewController: UIViewController, UITableViewDataSource { } @objc func printInstanceIDToken() { - let instanceID = InstanceID.instanceID().token() ?? "null" - print("InstanceID token: \(instanceID)") + InstanceID.instanceID().instanceID { (result, error) in + if let error = error { + print("Error fetching InstanceID: \(error)") + } else if let result = result { + print("InstanceID token: \(result.token)") + } + } } deinit { @@ -104,7 +109,7 @@ class ViewController: UIViewController, UITableViewDataSource { navigationController?.navigationBar.barTintColor = ViewController.lightColors.primary navigationController?.navigationBar.barStyle = .`default` navigationController?.navigationBar.titleTextAttributes = [ - NSAttributedStringKey.foregroundColor: UIColor.black + NSAttributedString.Key.foregroundColor: UIColor.black ] tableView.separatorColor = .gray tableView.backgroundColor = UIColor(red: 0.94, green: 0.94, blue: 0.94, alpha: 1) @@ -113,7 +118,7 @@ class ViewController: UIViewController, UITableViewDataSource { navigationController?.navigationBar.barTintColor = ViewController.darkColors.primary navigationController?.navigationBar.barStyle = .black navigationController?.navigationBar.titleTextAttributes = [ - NSAttributedStringKey.foregroundColor: UIColor.white + NSAttributedString.Key.foregroundColor: UIColor.white ] tableView.separatorColor = .lightGray tableView.backgroundColor = ViewController.darkColors.secondary