From 987936fe8ad8368d2c1d2dc919e8e1054fb400f5 Mon Sep 17 00:00:00 2001 From: Hongyan Jiang Date: Sun, 14 Jan 2024 17:45:43 -0800 Subject: [PATCH] Objective-C test app takes default value of InstanaSetupOptions parameter --- Dev/ObjectiveCAppExample/AppDelegate.m | 23 ++++++++++++++--------- Sources/InstanaAgent/Instana.swift | 4 ++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Dev/ObjectiveCAppExample/AppDelegate.m b/Dev/ObjectiveCAppExample/AppDelegate.m index 261ede4..c5aec13 100644 --- a/Dev/ObjectiveCAppExample/AppDelegate.m +++ b/Dev/ObjectiveCAppExample/AppDelegate.m @@ -16,17 +16,22 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - //note: explicitly get user permission before set enableCrashReporting to true - InstanaSetupOptions* options = [[InstanaSetupOptions alloc] initWithHttpCaptureConfig: 0 - collectionEnabled: true - enableCrashReporting: true - suspendReportingOnLowBattery: true - suspendReportingOnCellular: false - slowSendInterval: 0.0 - usiRefreshTimeIntervalInHrs: -1]; + (void)[Instana setupWithKey: @"INSTANA_REPORTING_KEY" reportingURL: [NSURL URLWithString: @"INSTANA_REPORTING_URL"] - options: options]; + options: nil]; + + //note: explicitly get user permission before set enableCrashReporting to true +// InstanaSetupOptions* options = [[InstanaSetupOptions alloc] initWithHttpCaptureConfig: 0 +// collectionEnabled: true +// enableCrashReporting: true +// suspendReportingOnLowBattery: true +// suspendReportingOnCellular: false +// slowSendInterval: 0.0 +// usiRefreshTimeIntervalInHrs: -1]; +// (void)[Instana setupWithKey: @"INSTANA_REPORTING_KEY" +// reportingURL: [NSURL URLWithString: @"INSTANA_REPORTING_URL"] +// options: options]; NSURL* url = [NSURL URLWithString: @"https://www.ibm.com/jp-ja"]; NSURLRequest* request = [NSURLRequest requestWithURL: url]; diff --git a/Sources/InstanaAgent/Instana.swift b/Sources/InstanaAgent/Instana.swift index bf67151..d70469e 100644 --- a/Sources/InstanaAgent/Instana.swift +++ b/Sources/InstanaAgent/Instana.swift @@ -133,7 +133,7 @@ import Foundation /// - reportingURL: Reporting URL for the Instana backend. /// - enableCrashReporting: Subscribe to metricKit events so as to enable crash reporting. /// App must have explicitly asked user permission to subscribe before this call. - @available(*, deprecated, message: "This method is deprecated. Use the setup() method with InstanaSetupOptions.") + @available(*, deprecated, message: "Use method setup(key: String, reportingURL: URL, options: InstanaSetupOptions?)") @objc public static func setup(key: String, reportingURL: URL, enableCrashReporting: Bool = false) { let config = InstanaConfiguration.default(key: key, reportingURL: reportingURL, @@ -153,7 +153,7 @@ import Foundation /// - collectionEnabled: Enable or disable collection (instrumentation) on setup. Can be changed later via the property `collectionEnabled` (Default: true) /// - enableCrashReporting: Subscribe to metricKit events so as to enable crash reporting. /// App must have explicitly asked user permission to subscribe before this call. - @available(*, deprecated, message: "This method is deprecated. Use the setup() method with InstanaSetupOptions.") + @available(*, deprecated, message: "Use method setup(key: String, reportingURL: URL, options: InstanaSetupOptions?)") @objc public static func setup(key: String, reportingURL: URL, httpCaptureConfig: HTTPCaptureConfig = .automatic,