{"_id":"59fb55b66d21b500324adf06","project":"55843604fd8d910d007b9502","version":{"_id":"558444ceafccfd0d00fcb2bb","forked_from":"55843604fd8d910d007b9505","project":"55843604fd8d910d007b9502","__v":67,"createdAt":"2015-06-19T16:35:26.435Z","releaseDate":"2015-06-19T16:35:26.435Z","categories":["558444cfafccfd0d00fcb2bc","558444cfafccfd0d00fcb2bd","55ad4ce733616a0d00599d2e","55ad4cef6aadf20d0015b764","55ad4cf36aadf20d0015b765","55ad4cfb24cf160d0013584f","55ad4d0024cf160d00135850","55ad4d0a24cf160d00135851","55ad4d0d24cf160d00135852","55ad4d126aadf20d0015b766","55ad4d1624cf160d00135853","55ad4d1933616a0d00599d2f","55ad4d2233616a0d00599d30","55ad4d2e24cf160d00135854","55d35b6bf77e6d0d00b1b092","55d3649a0168850d0073f14a","55d366d40168850d0073f15a","55d37fcff77e6d0d00b1b13f","55d383e50168850d0073f1e1","55d3ac26c336ec0d007c2251","55d3c51cb2330119009c31db","55d3c59bfe37111900e536f3","55d3c5a7fe37111900e536f4","55d3c5b4fe37111900e536f5","55d3c5d4fe37111900e536f6","55d3c5d6b2330119009c31df","55d3c5d71f478b170077c164","55d3c687b2330119009c31e4","55d3c6a4fe37111900e536f9","55d3c6befe37111900e536fa","55d3c6e8d2c66f0d00497f93","55d49dcfd7c16b2d007de905","55d4ca8f5082980d0009c79b","55d4cab9c95a3d2f0069ad3d","55d4d279c95a3d2f0069ad60","55d4d9355082980d0009c7e1","55d4f6b5988e130d000b3eb1","55d64dc8e60a2f0d00b88ecb","5627ca43fcbbc621004ec07d","56c64a0d8f98b50d0012c37c","56f1b8b13eb62a34003ea041","56f1b9df4476fb2200795e8c","57f6907dca5e5d1700039ae9","591dd06ca266c423002ec4ca","59234825e465c11900922518","5936f82eaa591e0027638d57","59972f54fd7078001992c136","599c6da8f180820025f14909","59b054613c3e1b0019cf27d9","59b1ceca2d6231003ad73e5f","59b1cf1857911600382e0dc4","59b1cf2730f3d60010c30ef7","59b1cf385d4b89003035441a","59b1cf5857911600382e0dc6","59bc2c4e26ac9b0010a8b753","59bc2ce20b3eb30010657b70","59f0c793ba3bc90030f413ab","59f0cd62f5ecda00325294b9","59fb55a8e8d0f600101aedc3","59fcb05c067f8d0028613f86","5a2af4a1bc5fba00283909c1","5a83673b0e56010012138c12","5a972f2e77b85a0070e4ebe2","5aa300224ed4b40012c53e1d","5acd20095efd8d000359bb3c","5ad50889c05179000306021e","5af0927a8779670003daff34","5b55a46b282b25000319669e"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3"},"category":{"_id":"59fb55a8e8d0f600101aedc3","project":"55843604fd8d910d007b9502","version":"558444ceafccfd0d00fcb2bb","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-11-02T17:28:08.726Z","from_sync":false,"order":5,"slug":"site-intercept-ios-sdk","title":"Mobile iOS Intercept SDK"},"user":"5919f13aff66b00f00f1948c","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-11-02T17:28:22.353Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"This reference guide covers the following APIs:\n\n- [Qualtrics Class](#qualtrics-class)\n- [Properties Class](#properties-class)\n- [QualtricsSurveyViewController Class](#qualtricssurveyviewcontroller-class)\n- [InitializationResult Class](#initializationresult-class)\n- [TargetingResult Class](#targetingresult-class)\n- [TargetingResultStatus Enum](#targetingresultstatus-enum)\n\n[block:api-header]\n{\n  \"title\": \"Qualtrics Class\"\n}\n[/block]\nThe **Qualtrics** class lets your app communicate with Qualtrics App Feedback. The **Qualtrics** class is represented as a singleton, and the singleton is accessible through its **shared** property. You can initialize the **Qualtrics** singleton with an intercept ID. To find this ID, see [Intercept ID for App Feedback](doc:intercept-id-for-site-intercept).\n\nFor more information about App Feedback and its key concepts, see [App Feedback Basics](https://www.qualtrics.com/support/website-app-feedback/common-use-cases/mobile-app-feedback-project/).\n\n## Usage\n\nThe iOS app first initializes the **Qualtrics** singleton with the brand ID, zone ID, intercept ID, and completion handler. You can do this in the app delegate (in **didFinishLaunchingWithOptions**). \n\nWhen you want to display a creative, use the **evaluateTargetingLogicWithCompletion** method to check the intercept's display logic on the server asynchronously. After evaluation of the intercept is complete, the method calls the completion block which returns a **TargetingResult** object to indicate to the app whether the creative should be displayed.\n\n## Property\n\n### properties\n\n###### Objective C\n\n**:::at:::property (nonatomic, readonly, strong) Properties \\* _Nonnull properties;**\n\n###### Swift\n\n**public var properties: Properties**\n\nThe properties object stores values that can be used throughout the app. Values placed in the object could include information such as the number of times the user has navigated to a specified view controller, location information, latency times, or other values that can be collected by the iOS device.\n\n## Methods\n\n### display\n\n###### Objective C\n\n**\\- (BOOL)displayWithViewController:(UIViewController \\* _Nonnull)viewController;**\n\n###### Swift\n\n**public func display(viewController: UIViewController) -> Bool**\n\nThis method displays the specified creative in the specified view controller. Typically, you need to evaluate whether the creative should be displayed by evaluating an intercept's logic using the **evaluateTargetingLogicWithCompletion** method.\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"BOOL displayResult = [[Qualtrics shared] displayWithViewController:self];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"let displayed = Qualtrics.shared.display(viewController: self)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n### evaluateTargetingLogicWithCompletion\n\n###### Objective C\n\n**\\- (void)evaluateTargetingLogicWithCompletion:(void (^ _Nonnull)(TargetingResult \\* _Nonnull))completion;**\n\n###### Swift\n\n**public func evaluateTargetingLogic(completion: @escaping ((Qualtrics.TargetingResult) -> Swift.Void))**\n\nThis method asynchronously evaluates the current intercept and calls the specified completion block with a **TargetingResult** object. The **TargetingResult** object indicates the result of the evaluation through the **passed** property.\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Qualtrics shared] evaluateTargetingLogicWithCompletion:^(TargetingResult * _Nonnull result)\\n{\\n  if(result.passed)\\n  {\\n      BOOL displayResult = [[Qualtrics shared] displayWithCurrentView:self.view];\\n  }\\n}];\\n\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"Qualtrics.shared.evaluateTargetingLogic { (result) in\\n    if(result.passed())\\n    {\\n        let displayed = Qualtrics.shared.display(currentView: self.view)\\n    }\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n### initialize\n\n###### Objective C\n\n**\\- (void)initializeWithBrandId:(NSString \\* _Nonnull)brandId zoneId:(NSString \\* _Nonnull)zoneId interceptId:(NSString \\* _Nonnull)interceptId completion:(void (^ _Nullable)(InitializationResult \\* _Nonnull))completion;**\n\n\n###### Swift\n\n**public func initialize(brandId: String, zoneId: String, interceptId: String, completion: ((Qualtrics.InitializationResult) -> Swift.Void)? = default)**\n\nThis method initializes the **Qualtrics** singleton using the specified brand ID, zone ID, intercept ID, and completion handler. You typically call this method in the app delegate's **applicationDidBecomeActive** method.\n\nThe method's **InitializationResult** (returned in the completion handler) indicates the state of initialization. See [InitializationResult Class](#initializationresult-class) for more information.\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void)applicationDidBecomeActive:(UIApplication *)application {\\n    \\n [Qualtrics.shared initializeWithBrandId:@\\\"Brand ID\\\" zoneId:@\\\"Project ID\\\" interceptId:@\\\"Intercept ID\\\" completion:^(InitializationResult * initializationResult) {\\n        // completion handler code\\n    }];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func applicationDidBecomeActive(_ application: UIApplication) {\\n\\n   Qualtrics.shared.initialize(brandId: \\\"Brand ID\\\", zoneId: \\\"Zone ID\\\", interceptId: \\\"Intercept ID\\\") { (initializationResult) in\\n           // completion handler \\n        }\\n}\\n\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n### registerViewVisitWithViewName\n\n###### Objective C\n\n**- (void)registerViewVisitWithViewName:(NSString \\* _Nonnull)viewName;**\n\n###### Swift\n\n**public func registerViewVisit(viewName: String)**\n\nYou can use this method to record visits to a particular view.\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Qualtrics.shared registerViewVisitWithViewName:@\\\"MainView\\\"];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"Qualtrics.shared.registerViewVisit(viewName: @\\\"MainView\\\")\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n### resetTimer\n\n###### Objective C\n\n**- (void)resetTimer;**\n\n###### Swift\n\n**public func resetTimer()**\n\nThis method resets the usage timer that is available to the intercept on the server as **Time Spent in App**.\n\n### resetViewCounter\n\n###### Objective C\n\n**- (void)resetViewCounter;**\n\n###### Swift\n\n**public func resetViewCounter()**\n\nThis method resets the view count to zero. It is available to the intercept as the **View Count** value in the intercept display logic.\n\n### shared\n\n###### Objective C\n\n**\\+ (Qualtrics \\* _Nonnull)shared;**\n\n###### Swift\n\n**class var shared: Qualtrics { get }**\n\nReturns the **Qualtrics** singleton object.\n\n[block:api-header]\n{\n  \"title\": \"Properties Class\"\n}\n[/block]\nThe **Properties** class allows you to store values that are sent back to the server and can be used as embedded data in surveys. For more information about using property values in surveys, see [Using Embedded Data](getting-started-si-with-ios#section-using-embedded-data).\n\n## Methods\n\n### setString\n\n###### Objective C\n\n**- (void)setStringWithString:(NSString \\* _Nonnull)string for:(NSString \\* _Nonnull)key;**\n\n###### Swift\n\n**public func setString(string: String, for key: String)**\n\nSets the string value for the specified key. The value is sent back to the server and can be used in the intercept. For an example, see [Using Embedded Data](getting-started-si-with-ios#section-using-embedded-data)\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Qualtrics.shared.properties setStringWithString:@\\\"John\\\" for:@\\\"firstName\\\"];\",\n      \"language\": \"objectivec\",\n      \"name\": \"Objective C\"\n    },\n    {\n      \"code\": \"Qualtrics.shared.properties.setString(string: \\\"John\\\", for: \\\"firstName\\\")\",\n      \"language\": \"swift\",\n      \"name\": \"Swift\"\n    }\n  ]\n}\n[/block]\n### setNumber\n\n###### Objective C\n\n**- (void)setNumberWithNumber:(double)string for:(NSString \\* _Nonnull)key;**\n\n###### Swift\n\n**public func setNumber(number: Number, for key: String)**\n\nSets the double value for the specified key. The value is sent back to the server and can be used in the intercept. For an example, see [Using Embedded Data](getting-started-si-with-ios#section-using-embedded-data)\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Qualtrics.shared.properties setNumberWithNumber:25.0 for:@\\\"age\\\"] ;\",\n      \"language\": \"objectivec\",\n      \"name\": null\n    },\n    {\n      \"code\": \"Qualtrics.shared.properties.setNumber(number: 25.0, for: \\\"age\\\")\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"QualtricsSurveyViewController Class\"\n}\n[/block]\nThe **QualtricsSurveyViewController** class creates a new view controller and displays the survey from the URL when the view controller was initialized.\n\n## Method\n\n### init\n\n###### Objective C\n\n**\\- (nonnull instancetype)initWithUrl:(NSString \\* _Nonnull)url;**\n\n###### Swift\n\n**public init(url: String)**\n\nThis method is the default initializer for this view controller. The URL is typically obtained from the **getSurveyUrl** method in the **TargetingResult** class.\n[block:api-header]\n{\n  \"title\": \"InitializationResult Class\"\n}\n[/block]\nThe **InitializationResult** class encapsulates information about Qualtrics App Feedback initialization.\n\n## Methods\n\n### getMessage\n\n###### Objective C\n\n**\\- (NSString \\* _Nullable)getMessage;**\n\n###### Swift\n\n**public func getMessage() -> String?**\n\nReturns the initialization message. You can use this message to determine App Feedback SDK initialization status.\n\n### passed;\n\n###### Objective C\n\n**\\- (BOOL)passed;**\n\n###### Swift\n\n**public func passed() -> Bool**\n\nIndicates whether initialization of the App Feedback SDK was successful.\n[block:api-header]\n{\n  \"title\": \"TargetingResult Class\"\n}\n[/block]\n## Methods\n\n### getError\n\n###### Objective C\n\n**This method is not available in Objective C.**\n\n###### Swift\n\n**func getError() -> Qualtrics.TargetingResultError?**\n\nThis method returns an **TargetingResultError** (a subclass of [Error](https://developer.apple.com/documentation/swift/error)) if the intercept failed to evaluate.\n\n### getSurveyUrl\n\n###### Objective C\n\n**\\- (NSString \\* _Nullable)getSurveyUrl;**\n\n###### Swift\n\n**public func getSurveyUrl() -> String?**\n\nThis method returns the link to the survey in the current creative. The link can be used by app code to display the survey in a **UIWebView** instead of calling **displayWithCurrentView**.\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Qualtrics shared] evaluateTargetingLogicWithCompletion:^(TargetingResult * _Nonnull result)\\n{\\n  if(result.passed)\\n  {\\n      NSString *survey = [result getSurveyUrl];\\n      NSLog(@\\\"Survey URL: %@\\\", survey);\\n  }\\n}];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"Qualtrics.shared.evaluateTargetingLogic { (result) in\\n    if(result.passed())\\n    {\\n    \\t\\tlet surveyURL = result.getSurveyUrl()\\n      \\tprint(\\\"Survey URL: \\\\(surveyURL!)\\\")\\n    }\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n### getTargetingResult\n\n###### Objective C\n\n**Not available**\n\n###### Swift\n\npublic func getTargetingResult() -> Qualtrics.targetingResultStatus?\n\nReturns the status of the targeting logic as a **TargetingResultStatus** value. See [TargetingResultStatus Enum](#targetingresultstatus-enum) for more information.\n\n### passed\n\n###### Objective C\n\n**\\- (BOOL)passed;**\n\n###### Swift\n\n**public func passed() -> Bool**\n\nThis property indicates the state of the server-side evaluation of the intercept. If it is **YES** (Objective C) or **true** (Swift), the creative should be displayed.\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Qualtrics shared] evaluateTargetingLogicWithCompletion:^(TargetingResult * _Nonnull result)\\n{\\n  if(result.passed)\\n  {\\n      BOOL displayResult = [[Qualtrics shared] displayWithCurrentView:self.view];\\n  }\\n}];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"Qualtrics.shared.evaluateTargetingLogic { (result) in\\n    if(result.passed())\\n    {\\n        let displayed = Qualtrics.shared.display(currentView: self.view)\\n    }\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n### recordClick\n\n###### Objective C\n\n**- (void)recordClick;**\n\n###### Swift\n\n**public func recordClick()**\n\nThe method records a click that is reported back to the server. It is associated with the intercept that was used to initialize the **Qualtrics** singleton. You can view the click statistics in the **View Stats** tab for the intercept. For more information, see [User Analytics with the Mobile App SDK](doc:page-view-and-impressions-with-the-mobile-sdk).\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Qualtrics.shared recordClick];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"Qualtrics.shared.recordClick()\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n### recordImpression\n\n###### Objective C\n\n**- (void)recordImpression;**\n\n###### Swift\n\n**public func recordImpression()**\n\nThis method reports an impression associated with the intercept when initializing the **Qualtrics** object (using the **initializeWithIntercept** method) back to the server. The impressions are reported in the **View Stats** tab for that intercept in the server user interface. For more information, see [User Analytics with the Mobile App SDK](doc:page-view-and-impressions-with-the-mobile-sdk).\n\n###### Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Qualtrics.shared recordImpression];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"Qualtrics.shared.recordImpression()\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"TargetingResultStatus Enum\"\n}\n[/block]\nThe **TargetingResultStatus** enum returns a status in the **TargetingResult** returned from the **evaluateTargetingLogicWithCompletion** method. It is accesed using the **TargetingResult.getTargetingResult** method.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Not Available in Objective C\",\n  \"body\": \"This enum and the **getTargetingResult** method are not available in Objective C.\"\n}\n[/block]\n### Values\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Value\",\n    \"h-1\": \"Meaning\",\n    \"0-0\": \"**passed**\",\n    \"1-0\": \"**failedLogic**\",\n    \"2-0\": \"**sampledOut**\",\n    \"3-0\": \"**multipleDisplayPrevented**\",\n    \"4-0\": \"**error**\",\n    \"0-1\": \"Targeting logic passed successfully.\",\n    \"1-1\": \"The targeting logic did not pass.\",\n    \"2-1\": \"The targeting logic passed, but the intercept sampling rate prevented the survey invitation from appearing.\",\n    \"3-1\": \"The survey invitation has a **Prevent Repeated Display** option set. This prevents the survey invitation from appearing again for a specified time period.\",\n    \"4-1\": \"An error occurred when attempting to evaluate targeting logic. Use the **getError** method on the **TargetingResult** object to determine more about this error.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]","excerpt":"","slug":"si-ios-sdk-reference","type":"basic","title":"App Feedback iOS API Reference"}

App Feedback iOS API Reference


This reference guide covers the following APIs: - [Qualtrics Class](#qualtrics-class) - [Properties Class](#properties-class) - [QualtricsSurveyViewController Class](#qualtricssurveyviewcontroller-class) - [InitializationResult Class](#initializationresult-class) - [TargetingResult Class](#targetingresult-class) - [TargetingResultStatus Enum](#targetingresultstatus-enum) [block:api-header] { "title": "Qualtrics Class" } [/block] The **Qualtrics** class lets your app communicate with Qualtrics App Feedback. The **Qualtrics** class is represented as a singleton, and the singleton is accessible through its **shared** property. You can initialize the **Qualtrics** singleton with an intercept ID. To find this ID, see [Intercept ID for App Feedback](doc:intercept-id-for-site-intercept). For more information about App Feedback and its key concepts, see [App Feedback Basics](https://www.qualtrics.com/support/website-app-feedback/common-use-cases/mobile-app-feedback-project/). ## Usage The iOS app first initializes the **Qualtrics** singleton with the brand ID, zone ID, intercept ID, and completion handler. You can do this in the app delegate (in **didFinishLaunchingWithOptions**). When you want to display a creative, use the **evaluateTargetingLogicWithCompletion** method to check the intercept's display logic on the server asynchronously. After evaluation of the intercept is complete, the method calls the completion block which returns a **TargetingResult** object to indicate to the app whether the creative should be displayed. ## Property ### properties ###### Objective C **@property (nonatomic, readonly, strong) Properties \* _Nonnull properties;** ###### Swift **public var properties: Properties** The properties object stores values that can be used throughout the app. Values placed in the object could include information such as the number of times the user has navigated to a specified view controller, location information, latency times, or other values that can be collected by the iOS device. ## Methods ### display ###### Objective C **\- (BOOL)displayWithViewController:(UIViewController \* _Nonnull)viewController;** ###### Swift **public func display(viewController: UIViewController) -> Bool** This method displays the specified creative in the specified view controller. Typically, you need to evaluate whether the creative should be displayed by evaluating an intercept's logic using the **evaluateTargetingLogicWithCompletion** method. ###### Example [block:code] { "codes": [ { "code": "BOOL displayResult = [[Qualtrics shared] displayWithViewController:self];", "language": "objectivec" }, { "code": "let displayed = Qualtrics.shared.display(viewController: self)", "language": "swift" } ] } [/block] ### evaluateTargetingLogicWithCompletion ###### Objective C **\- (void)evaluateTargetingLogicWithCompletion:(void (^ _Nonnull)(TargetingResult \* _Nonnull))completion;** ###### Swift **public func evaluateTargetingLogic(completion: @escaping ((Qualtrics.TargetingResult) -> Swift.Void))** This method asynchronously evaluates the current intercept and calls the specified completion block with a **TargetingResult** object. The **TargetingResult** object indicates the result of the evaluation through the **passed** property. ###### Example [block:code] { "codes": [ { "code": "[[Qualtrics shared] evaluateTargetingLogicWithCompletion:^(TargetingResult * _Nonnull result)\n{\n if(result.passed)\n {\n BOOL displayResult = [[Qualtrics shared] displayWithCurrentView:self.view];\n }\n}];\n", "language": "objectivec" }, { "code": "Qualtrics.shared.evaluateTargetingLogic { (result) in\n if(result.passed())\n {\n let displayed = Qualtrics.shared.display(currentView: self.view)\n }\n}", "language": "swift" } ] } [/block] ### initialize ###### Objective C **\- (void)initializeWithBrandId:(NSString \* _Nonnull)brandId zoneId:(NSString \* _Nonnull)zoneId interceptId:(NSString \* _Nonnull)interceptId completion:(void (^ _Nullable)(InitializationResult \* _Nonnull))completion;** ###### Swift **public func initialize(brandId: String, zoneId: String, interceptId: String, completion: ((Qualtrics.InitializationResult) -> Swift.Void)? = default)** This method initializes the **Qualtrics** singleton using the specified brand ID, zone ID, intercept ID, and completion handler. You typically call this method in the app delegate's **applicationDidBecomeActive** method. The method's **InitializationResult** (returned in the completion handler) indicates the state of initialization. See [InitializationResult Class](#initializationresult-class) for more information. ###### Example [block:code] { "codes": [ { "code": "- (void)applicationDidBecomeActive:(UIApplication *)application {\n \n [Qualtrics.shared initializeWithBrandId:@\"Brand ID\" zoneId:@\"Project ID\" interceptId:@\"Intercept ID\" completion:^(InitializationResult * initializationResult) {\n // completion handler code\n }];\n}", "language": "objectivec" }, { "code": "func applicationDidBecomeActive(_ application: UIApplication) {\n\n Qualtrics.shared.initialize(brandId: \"Brand ID\", zoneId: \"Zone ID\", interceptId: \"Intercept ID\") { (initializationResult) in\n // completion handler \n }\n}\n", "language": "swift" } ] } [/block] ### registerViewVisitWithViewName ###### Objective C **- (void)registerViewVisitWithViewName:(NSString \* _Nonnull)viewName;** ###### Swift **public func registerViewVisit(viewName: String)** You can use this method to record visits to a particular view. ###### Example [block:code] { "codes": [ { "code": "[Qualtrics.shared registerViewVisitWithViewName:@\"MainView\"];", "language": "objectivec" }, { "code": "Qualtrics.shared.registerViewVisit(viewName: @\"MainView\")", "language": "swift" } ] } [/block] ### resetTimer ###### Objective C **- (void)resetTimer;** ###### Swift **public func resetTimer()** This method resets the usage timer that is available to the intercept on the server as **Time Spent in App**. ### resetViewCounter ###### Objective C **- (void)resetViewCounter;** ###### Swift **public func resetViewCounter()** This method resets the view count to zero. It is available to the intercept as the **View Count** value in the intercept display logic. ### shared ###### Objective C **\+ (Qualtrics \* _Nonnull)shared;** ###### Swift **class var shared: Qualtrics { get }** Returns the **Qualtrics** singleton object. [block:api-header] { "title": "Properties Class" } [/block] The **Properties** class allows you to store values that are sent back to the server and can be used as embedded data in surveys. For more information about using property values in surveys, see [Using Embedded Data](getting-started-si-with-ios#section-using-embedded-data). ## Methods ### setString ###### Objective C **- (void)setStringWithString:(NSString \* _Nonnull)string for:(NSString \* _Nonnull)key;** ###### Swift **public func setString(string: String, for key: String)** Sets the string value for the specified key. The value is sent back to the server and can be used in the intercept. For an example, see [Using Embedded Data](getting-started-si-with-ios#section-using-embedded-data) ###### Example [block:code] { "codes": [ { "code": "[Qualtrics.shared.properties setStringWithString:@\"John\" for:@\"firstName\"];", "language": "objectivec", "name": "Objective C" }, { "code": "Qualtrics.shared.properties.setString(string: \"John\", for: \"firstName\")", "language": "swift", "name": "Swift" } ] } [/block] ### setNumber ###### Objective C **- (void)setNumberWithNumber:(double)string for:(NSString \* _Nonnull)key;** ###### Swift **public func setNumber(number: Number, for key: String)** Sets the double value for the specified key. The value is sent back to the server and can be used in the intercept. For an example, see [Using Embedded Data](getting-started-si-with-ios#section-using-embedded-data) ###### Example [block:code] { "codes": [ { "code": "[Qualtrics.shared.properties setNumberWithNumber:25.0 for:@\"age\"] ;", "language": "objectivec", "name": null }, { "code": "Qualtrics.shared.properties.setNumber(number: 25.0, for: \"age\")", "language": "swift" } ] } [/block] [block:api-header] { "title": "QualtricsSurveyViewController Class" } [/block] The **QualtricsSurveyViewController** class creates a new view controller and displays the survey from the URL when the view controller was initialized. ## Method ### init ###### Objective C **\- (nonnull instancetype)initWithUrl:(NSString \* _Nonnull)url;** ###### Swift **public init(url: String)** This method is the default initializer for this view controller. The URL is typically obtained from the **getSurveyUrl** method in the **TargetingResult** class. [block:api-header] { "title": "InitializationResult Class" } [/block] The **InitializationResult** class encapsulates information about Qualtrics App Feedback initialization. ## Methods ### getMessage ###### Objective C **\- (NSString \* _Nullable)getMessage;** ###### Swift **public func getMessage() -> String?** Returns the initialization message. You can use this message to determine App Feedback SDK initialization status. ### passed; ###### Objective C **\- (BOOL)passed;** ###### Swift **public func passed() -> Bool** Indicates whether initialization of the App Feedback SDK was successful. [block:api-header] { "title": "TargetingResult Class" } [/block] ## Methods ### getError ###### Objective C **This method is not available in Objective C.** ###### Swift **func getError() -> Qualtrics.TargetingResultError?** This method returns an **TargetingResultError** (a subclass of [Error](https://developer.apple.com/documentation/swift/error)) if the intercept failed to evaluate. ### getSurveyUrl ###### Objective C **\- (NSString \* _Nullable)getSurveyUrl;** ###### Swift **public func getSurveyUrl() -> String?** This method returns the link to the survey in the current creative. The link can be used by app code to display the survey in a **UIWebView** instead of calling **displayWithCurrentView**. ###### Example [block:code] { "codes": [ { "code": "[[Qualtrics shared] evaluateTargetingLogicWithCompletion:^(TargetingResult * _Nonnull result)\n{\n if(result.passed)\n {\n NSString *survey = [result getSurveyUrl];\n NSLog(@\"Survey URL: %@\", survey);\n }\n}];", "language": "objectivec" }, { "code": "Qualtrics.shared.evaluateTargetingLogic { (result) in\n if(result.passed())\n {\n \t\tlet surveyURL = result.getSurveyUrl()\n \tprint(\"Survey URL: \\(surveyURL!)\")\n }\n}", "language": "swift" } ] } [/block] ### getTargetingResult ###### Objective C **Not available** ###### Swift public func getTargetingResult() -> Qualtrics.targetingResultStatus? Returns the status of the targeting logic as a **TargetingResultStatus** value. See [TargetingResultStatus Enum](#targetingresultstatus-enum) for more information. ### passed ###### Objective C **\- (BOOL)passed;** ###### Swift **public func passed() -> Bool** This property indicates the state of the server-side evaluation of the intercept. If it is **YES** (Objective C) or **true** (Swift), the creative should be displayed. ###### Example [block:code] { "codes": [ { "code": "[[Qualtrics shared] evaluateTargetingLogicWithCompletion:^(TargetingResult * _Nonnull result)\n{\n if(result.passed)\n {\n BOOL displayResult = [[Qualtrics shared] displayWithCurrentView:self.view];\n }\n}];", "language": "objectivec" }, { "code": "Qualtrics.shared.evaluateTargetingLogic { (result) in\n if(result.passed())\n {\n let displayed = Qualtrics.shared.display(currentView: self.view)\n }\n}", "language": "swift" } ] } [/block] ### recordClick ###### Objective C **- (void)recordClick;** ###### Swift **public func recordClick()** The method records a click that is reported back to the server. It is associated with the intercept that was used to initialize the **Qualtrics** singleton. You can view the click statistics in the **View Stats** tab for the intercept. For more information, see [User Analytics with the Mobile App SDK](doc:page-view-and-impressions-with-the-mobile-sdk). ###### Example [block:code] { "codes": [ { "code": "[Qualtrics.shared recordClick];", "language": "objectivec" }, { "code": "Qualtrics.shared.recordClick()", "language": "swift" } ] } [/block] ### recordImpression ###### Objective C **- (void)recordImpression;** ###### Swift **public func recordImpression()** This method reports an impression associated with the intercept when initializing the **Qualtrics** object (using the **initializeWithIntercept** method) back to the server. The impressions are reported in the **View Stats** tab for that intercept in the server user interface. For more information, see [User Analytics with the Mobile App SDK](doc:page-view-and-impressions-with-the-mobile-sdk). ###### Example [block:code] { "codes": [ { "code": "[Qualtrics.shared recordImpression];", "language": "objectivec" }, { "code": "Qualtrics.shared.recordImpression()", "language": "swift" } ] } [/block] [block:api-header] { "title": "TargetingResultStatus Enum" } [/block] The **TargetingResultStatus** enum returns a status in the **TargetingResult** returned from the **evaluateTargetingLogicWithCompletion** method. It is accesed using the **TargetingResult.getTargetingResult** method. [block:callout] { "type": "warning", "title": "Not Available in Objective C", "body": "This enum and the **getTargetingResult** method are not available in Objective C." } [/block] ### Values [block:parameters] { "data": { "h-0": "Value", "h-1": "Meaning", "0-0": "**passed**", "1-0": "**failedLogic**", "2-0": "**sampledOut**", "3-0": "**multipleDisplayPrevented**", "4-0": "**error**", "0-1": "Targeting logic passed successfully.", "1-1": "The targeting logic did not pass.", "2-1": "The targeting logic passed, but the intercept sampling rate prevented the survey invitation from appearing.", "3-1": "The survey invitation has a **Prevent Repeated Display** option set. This prevents the survey invitation from appearing again for a specified time period.", "4-1": "An error occurred when attempting to evaluate targeting logic. Use the **getError** method on the **TargetingResult** object to determine more about this error." }, "cols": 2, "rows": 5 } [/block]