{"id":7,"date":"2018-08-24T23:16:44","date_gmt":"2018-08-24T23:16:44","guid":{"rendered":"https:\/\/www.xlsoft.com\/doc\/kudan\/?page_id=7"},"modified":"2023-07-13T20:42:32","modified_gmt":"2023-07-13T20:42:32","slug":"getting-started","status":"publish","type":"page","link":"https:\/\/www.xlsoft.com\/doc\/kudan\/getting-started\/","title":{"rendered":"iOS Getting Started"},"content":{"rendered":"<header id=\"content-head\">\n<div>NOTE: iOS apps built with Kudan AR SDK can no longer be published to the Apple Store. See \u00a0<a href=\"https:\/\/www.xlsoft.com\/doc\/kudan\/ios-version-history\/\">Details<\/a>.<\/div>\n<div><\/div>\n<p><\/p>\n<div class=\"row clearfix\">This tutorial will show you how to setup an augmented reality project on iOS using KudanAR.<\/div>\n<\/header>\n<p>&nbsp;<\/p>\n<div id=\"content-container\" class=\"grid-container-fluid\">\n<section class=\"content-body\">\n<div class=\"magic-block-api-header\">\n<div id=\"section-download-kudans-ar-framework-for-ios\" class=\"anchor waypoint\"><\/div>\n<div class=\"magic-block-textarea\">\n<h3 class=\"header-scroll is-api-header\">Download Kudan&#8217;s AR Framework for iOS<\/h3>\n<p>To get started, the first thing you&#8217;ll need is Kudan&#8217;s AR framework. You can download it on our\u00a0<a href=\"https:\/\/www.xlsoft.com\/en\/products\/kudan\/download.html\" target=\"_blank\" rel=\"noopener\">Download<\/a>\u00a0page.<\/p>\n<div>\n<div class=\"magic-block-image\">\n<figure><a class=\"block-display-image-parent block-display-image-size-smart block-display-image-border\" href=\"https:\/\/files.readme.io\/ee076d1-Kudan_Download_Page_iOS.png\"><img decoding=\"async\" src=\"https:\/\/files.readme.io\/ee076d1-Kudan_Download_Page_iOS.png\" alt=\"Download the iOS SDK\" \/><\/a><\/figure>\n<p><center>Download the iOS SDK<\/center><\/div>\n<p>&nbsp;<\/p>\n<div class=\"magic-block-api-header\">\n<div id=\"section-create-a-new-xcode-project\" class=\"anchor waypoint\"><\/div>\n<h2 class=\"header-scroll is-api-header\">Create a new Xcode project<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>Start up Xcode and create a new Xcode project. If all you want is an AR view, just leave it on the default &#8220;Single View Application&#8221; and click next.<\/p>\n<p>Amongst other details, you&#8217;ll be required to enter a\u00a0<em>Product Name<\/em>\u00a0and\u00a0<em>Organization Identifier<\/em>. These two fields together make up your\u00a0<em>Bundle Identifier<\/em>. You must make sure that this is the same as the Bundle Identifier associated with your API Key. This will either be the Bundle Identifier you used when generating a free API Key, or, if you are using the\u00a0<a href=\"https:\/\/www.xlsoft.com\/doc\/kudan\/development-license-keys\/\">Development License Key<\/a>, simply\u00a0<mark><code>com.xlsoft.kudanar<\/code><\/mark>.<\/p>\n<\/div>\n<div class=\"magic-block-image\">\n<figure><a class=\"block-display-image-parent block-display-image-size-smart \" href=\"https:\/\/files.readme.io\/7d1243c-Xcode_New_Project.png\"><img decoding=\"async\" src=\"https:\/\/files.readme.io\/7d1243c-Xcode_New_Project.png\" alt=\"Create a new Xcode Project\" \/><\/a><\/figure>\n<p><center>Create a new Xcode Project<\/center><\/div>\n<p>&nbsp;<\/p>\n<div class=\"magic-block-api-header\">\n<div id=\"section-import-kudans-ar-framework-to-the-project\" class=\"anchor waypoint\"><\/div>\n<h2 class=\"header-scroll is-api-header\">Import Kudan&#8217;s AR Framework to the project<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>Copy or move the\u00a0<mark><code>KudanAR.framework<\/code><\/mark>\u00a0file into the project folder, then import it into the project, either by dragging and dropping the file from the folder into the project hierarchy, or by clicking\u00a0<em>File -&gt; Add Files to &#8220;&lt;Project&gt;&#8221;<\/em>\u00a0to add the file.<\/p>\n<\/div>\n<div class=\"magic-block-image\">\n<figure><a class=\"block-display-image-parent block-display-image-size-smart \" href=\"https:\/\/files.readme.io\/d2eb081-addkudantoproject.gif\"><img decoding=\"async\" src=\"https:\/\/files.readme.io\/d2eb081-addkudantoproject.gif\" alt=\"Add Kudan's framework to the project\" \/><\/a><\/figure>\n<p><center>Add Kudan&#8217;s framework to the project<\/center><\/div>\n<p>&nbsp;<\/p>\n<div class=\"magic-block-api-header\">\n<div id=\"section-import-the-libc-standard-library-to-the-project\" class=\"anchor waypoint\"><\/div>\n<h2 class=\"header-scroll is-api-header\">Import the libc++ standard library to the project<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>Import the\u00a0<strong>libc++<\/strong>\u00a0library to your project by selecting the workspace of your project, scrolling to the bottom of the\u00a0<em>General<\/em>\u00a0tab, clicking the small + icon in the\u00a0<em>Linked Frameworks and Binaries<\/em>\u00a0section, search for &#8220;libc++&#8221; and add the\u00a0<mark><code>libc++.tbd<\/code><\/mark> file.<\/p>\n<\/div>\n<div class=\"magic-block-image\">\n<figure><a class=\"block-display-image-parent block-display-image-size-smart \" href=\"https:\/\/files.readme.io\/22a2fd7-addlibc.gif\"><img decoding=\"async\" src=\"https:\/\/files.readme.io\/22a2fd7-addlibc.gif\" alt=\"Add libc++ to the project\" \/><\/a><\/figure>\n<p><center>Add libc++ to the project<\/center><\/div>\n<p>&nbsp;<\/p>\n<div class=\"magic-block-api-header\">\n<div id=\"section-disable-bitcode\" class=\"anchor waypoint\"><\/div>\n<h2 class=\"header-scroll is-api-header\">Disable Bitcode<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>If you attempt to build your project now, it will fail, and you will receive the following error message :<\/p>\n<\/div>\n<div class=\"su-note\"  style=\"border-color:#fdf7f7;;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#fdf7f7;;border-color:#fdf7f7;;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<h3 style=\"color: red;\"><i class=\"fa fa-exclamation-triangle\" title=\"Danger\"><\/i>Apple Mach-O Linker (ld) Error<\/h3>\n<p style=\"color: gray;\">ld: &#8216;\/KudanAR.framework\/KudanAR(KudanAR-arm64-master.o)&#8217; does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64<\/p>\n<p>clang: error: linker command failed with exit code 1 (use -v to see invocation)<\/p>\n<\/div><\/div>\n<div class=\"magic-block-textarea\">\n<p>This is because Kudan&#8217;s AR framework is a fat binary. To disable Bitcode, go to the\u00a0<mark><code>Build Settings<\/code><\/mark>\u00a0tab of your workspace, scroll down to\u00a0<mark><code>Build Options<\/code><\/mark>, and set\u00a0<strong>Enable Bitcode<\/strong>\u00a0to\u00a0<em>No<\/em>.<\/p>\n<\/div>\n<div class=\"magic-block-image\">\n<figure><a class=\"block-display-image-parent block-display-image-size-smart \" href=\"https:\/\/files.readme.io\/6136877-DisableBitcode.png\"><img decoding=\"async\" src=\"https:\/\/files.readme.io\/6136877-DisableBitcode.png\" alt=\"Disable Bitcode\" \/><\/a><\/figure>\n<p><center>Disable Bitcode<\/center><\/div>\n<p>&nbsp;<\/p>\n<div class=\"magic-block-api-header\">\n<div id=\"section-add-info.plist\" class=\"anchor waypoint\"><\/div>\n<h2 class=\"header-scroll is-api-header\">Add to Info.plist<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>Info.plist key &#8211; The app&#8217;s Info.plist must contain an NSCameraUsageDescription key with a string value describing how the app uses the data.<\/p>\n<p>&#8220;Privacy &#8211; Camera Usage Description&#8221;<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"magic-block-api-header\">\n<h2 class=\"header-scroll is-api-header\">Add Property Declaration<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>For Objective-C Declaration, add to AppDelegate.h:<\/p>\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">AppDelegate.h<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"AppDelegate.h\">\n[code lang=&#8221;Java&#8221;]\n@property (strong, nonatomic) UIWindow *window;<br \/>\n[\/code]\n<\/div><\/div><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"magic-block-api-header\">\n<h2 class=\"header-scroll is-api-header\">Import the ARAPIKey class to your App Delegate<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>Open the AppDelegate in your project and change it to the following:<\/p>\n<\/div>\n<div class=\"block-code-code\">\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">AppDelegate.m<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">AppDelegate.swift<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"AppDelegate.m\">\n[code lang=&#8221;Java&#8221;]#import &quot;AppDelegate.h&quot;<br \/>\n#import &lt;KudanAR\/ARAPIKey.h&gt;<\/p>\n<p>@interface AppDelegate ()<br \/>\n@end<\/p>\n<p>@implementation AppDelegate<\/p>\n<p>&#8211; (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions<br \/>\n{<br \/>\n    [[ARAPIKey sharedInstance] setAPIKey:@&lt;Put API Key here&gt;];<\/p>\n<p>    return YES;<br \/>\n}<\/p>\n<p>@end[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"AppDelegate.swift\">\n[code lang=&#8221;Java&#8221;]import UIKit<br \/>\nimport KudanAR.ARAPIKey<\/p>\n<p>@UIApplicationMain<br \/>\nclass AppDelegate: UIResponder, UIApplicationDelegate {<\/p>\n<p>    var window: UIWindow?<\/p>\n<p>    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&amp;gt; Bool {<\/p>\n<p>        ARAPIKey.sharedInstance().setAPIKey(&quot;&lt;Put API Key here&gt;&quot;)<\/p>\n<p>        return true<br \/>\n    }<\/p>\n<p>}[\/code]\n<\/div><\/div><\/div>\n<\/div>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>Find the API Key for your corresponding Bundle ID:<\/p>\n<ul>\n<li>If using your own Bundle ID, this will be the key generated on the\u00a0<a href=\"https:\/\/www.kudan.eu\/keys\/\" target=\"_blank\" rel=\"noopener\">website<\/a><\/li>\n<li>If using the\u00a0<mark><code>com.xlsoft.kudanar<\/code><\/mark>\u00a0development Bundle ID, you can use the\u00a0<a href=\"https:\/\/www.xlsoft.com\/doc\/kudan\/development-license-keys\/\">Development License Key<\/a>. Note that while this key dos not display a Watermark, it cannot be used to upload your app to the app store. To publish your app, you will need to generate a free key on the website (see above), or purchase a license.<\/li>\n<\/ul>\n<\/div>\n<div class=\"magic-block-api-header\">\n<div id=\"section-set-up-your-view-controller\" class=\"anchor waypoint\"><\/div>\n<h2 class=\"header-scroll is-api-header\">Set up your View Controller<\/h2>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>Make sure your View Controller is a subclass of\u00a0<mark><code>ARCameraViewController<\/code><\/mark>:<\/p>\n<\/div>\n<div class=\"magic-block-code\">\n<div class=\"block-code-code\">\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">ViewController.h<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">ViewController.swift<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"ViewController.h\">\n[code lang=&#8221;Java&#8221;]#import &lt;KudanAR\/KudanAR.h&gt;<\/p>\n<p>@interface ViewController : ARCameraViewController<\/p>\n<p>@end<\/p>\n<p>}[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"ViewController.swift\">\n[code lang=&#8221;Java&#8221;]import UIKit<br \/>\nimport KudanAR<\/p>\n<p>class ViewController: ARCameraViewController {<\/p>\n<p>}[\/code]\n<\/div><\/div><\/div>\n<\/div>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>This will allow you to implement the\u00a0<mark><code>setupContent<\/code><\/mark>\u00a0method in your View Controller. The\u00a0<mark><code>setupContent<\/code><\/mark>\u00a0method is called when the\u00a0<mark><code>ARCameraViewController<\/code><\/mark>\u00a0first loads. For example:<\/p>\n<\/div>\n<div class=\"magic-block-code\">\n<div class=\"block-code-code\">\n<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">ViewController.m<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">ViewController.swift<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"ViewController.m\">\n[code lang=&#8221;Java&#8221;]#import &quot;ViewController.h&quot;<\/p>\n<p>@interface ViewController ()<br \/>\n@end<\/p>\n<p>@implementation ViewController<\/p>\n<p>&#8211; (void)setupContent<br \/>\n{<br \/>\n  \/\/ Setup code goes here<br \/>\n}<\/p>\n<p>@end[\/code]\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"ViewController.swift\">\n[code lang=&#8221;Java&#8221;]import UIKit<br \/>\nimport KudanAR<\/p>\n<p>class ViewController: ARCameraViewController<br \/>\n{<br \/>\n    override func setupContent()<br \/>\n    {<br \/>\n    \t\/\/ Setup code goes here<br \/>\n    }<br \/>\n}[\/code]\n<\/div><\/div><\/div>\n<\/div>\n<\/div>\n<div class=\"magic-block-textarea\">\n<p>If you changed your View Controller to look like the above, you can build and run your app. You should see a camera stream displaying on your screen, but you can&#8217;t detect or track anything just yet. We&#8217;ll change that in the next tutorial.<\/p>\n<\/div>\n<hr \/>\n<div class=\"nextSteps\">\n<h3>What&#8217;s Next<\/h3>\n<p>Set up an image trackable and add an image to it.<\/p>\n<table>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/www.xlsoft.com\/doc\/kudan\/marker-basics\/\"><i class=\"fa fa-chevron-right\"><\/i>Marker Basics<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>NOTE: iOS apps built with Kudan AR SDK can no longer be published to the Apple Store. See \u00a0Details. This tutorial will show you how to setup an augmented reality project on iOS using KudanAR. &nbsp; Download Kudan&#8217;s AR Framework for iOS To get started, the first thing you&#8217;ll need is Kudan&#8217;s AR framework. You &#8230; <a title=\"iOS Getting Started\" class=\"read-more\" href=\"https:\/\/www.xlsoft.com\/doc\/kudan\/getting-started\/\">Read more<span class=\"screen-reader-text\">iOS Getting Started<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"bekko_page_header":""},"_links":{"self":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages\/7"}],"collection":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":209,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages\/7\/revisions"}],"predecessor-version":[{"id":2504,"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/pages\/7\/revisions\/2504"}],"wp:attachment":[{"href":"https:\/\/www.xlsoft.com\/doc\/kudan\/wp-json\/wp\/v2\/media?parent=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}