How to Make an Augmented Reality iPhone App Using ARKit
As we mentioned in an earlier article, Apple has long-promised to make a major splash in the AR market. With the recent release of the Apple augmented reality developer framework, ARKit, consider the market properly splashed.
Building a complete, full-featured app is beyond the scope of a single article. However, we can show you, in simplest terms, how to create augmented reality apps for iPhone and iPad using the Unity 3D AR/VR platform with ARKit. Our simple example will display an AR point cloud superimposed over objects you can view with your Apple device.
Learning how to make your first augmented reality iPhone app using ARKit’s powerful features is the fun part. But first, your computer and mobile devices need a bit of tweaking. Although installing some upgrades is required before you can explore ARKit, we have made quick work of it for you by providing the steps you need to get your computer and mobile devices ready.
In this article, you will how to create augmented reality apps for iPhone and iPad, but more importantly, you will create your first app with ARKit features.
Getting Started With ARKit
To get started building the basic Apple augmented reality app, you need a Mac computer, plus five pieces of software:
- Beta versions of macOS 10.13
- iOS 11 Beta 3
- XCode 9 Beta (required by Unity)
- Unity, with the 5.6.1p1 patch applied
- The ARKit Plugin
You will need macOS 10.13 Beta installed on your Mac, and iOS 11 Beta installed on your iPhone or iPad. XCode 9 Beta 2 is required by Unity, which you will use to work in ARKit. Yes, even Mac has its software dependencies.
To download the beta versions of Apple products (macOS 10.13 and iOS 11 Beta), you will need a developer’s account. Registration is quick and easy, and, best of all, free. As with any software installation — especially involving beta products, performance may be buggy, so proceed at your own risk.
To see your augmented reality app on iPhone or iPad, you will also need an iOS device that supports ARKit. Either of these devices will do:
- iPhone 6S or later
- iPad 2017 or later
Installing Beta versions of macOS 10.13
Before you take the plunge and load a beta version of your system OS, you should perform a system backup, just in case. You can follow these steps to backup your Mac, and to then download and install the beta OS.
Both iOS 11 Beta and iOS 11 Beta releases are intended for developers at this time, so you will need to login to your developer’s account, which we mentioned a moment ago.
Have a AR/VR Project in Mind? We Are Here to Discuss
Installing iOS 11 Beta 2
To test your applications, you will want to run them on your iPhone or iPad. Applications developed in ARKit are designed to run on Apple’s latest mobile OS, iOS 11. Still in beta stage, iOS offers many new features that, among other things, makes the most out of AR experiences.
You can follow these easy, step-by-step instructions for downloading and installing. Note that the instructions include links to recently updated information at the bottom. You might want to follow those links before beginning your installation, since they contain the latest information.
XCode 9 Beta
“To install Xcode during the beta period, download the XIP file, double-click the file to expand it in place, then drag Xcode-beta.app to the Applications folder.”
Xcode 9 beta 2 includes the latest beta macOS, iOS, watchOS, and tvOS SDKs.
Downloading the ARKit Plugin
The ARKit plugin for Unity provides developers access to all of the exciting features included in Apple’s ARKit, including:
- ambient light estimation
- world tracking
- live video rendering
- hit-testing API
- point cloud extraction
- plane estimation and updates
Downloading Unity 5.6.1p1
If you do not already have Unity installed, you will want to do that now. Download is free for personal use. You can download it directly from the Unity Store.
If you already have Unity installed, download and install the 5.6.1p1 patch, which applies for all versions.
Building Your First Apple ARKit AR App
Now that the hard work is done, you will follow these steps to build your point cloud viewer:
- Click on the Unity icon located on your dock.
- When the welcome screen appears, click NEW in the right top corner of the box.
- Under Project name, enter a name such as My First ARKit App for your project.
- You can change the default location of the project if you wish, or you can leave it as is.
- When you have entered your project name, click the Create project button.
- In the Project window, pull the finder window with “unity-arkit-plugin.unitypackage” to the front.
- Double-click on the file named unity-arkit-plugin.unitypackage. It will take just a moment for the file to be unpacked.
- The Import Unity Package window will appear when the file has been unpacked. You will see all of the files that are included. Click on the Import button at the bottom of the box.
- In the Project window, double-click the file titled UnityARKitScene.
- From the Project window menu, click File, then Build Settings. This will open the Build Settings window we need for the next step.
- From the Build Settings menu items, under Platform, click iOS.
- Click the Switch Platform button located on the bottom left corner of the box.
- Click the Add Open Scenes button.
- Click the Player Settings button.
- Under the Inspector tab, look for the label, Camera Usage Description. In the box to the right of the label, type “camera use.” Failure to enter a value here can cause your app to crash.
- Returning to the Build Settings window, click on the Build button.
- The Save As box will appear, asking where you want to save your project. Type “App” and click on the Save button.
- Unity will take just a moment to build your project. When it is done, a Finder window will open. Double-click on the App folder.
- Double-click the Unity-iPhone.xcodeproj file.
- A window will appear showing the Identity, Signing, and Deployment information for your project.
- In the section labeled Signing, click on the Team drop-down box and select your developer account. This is the account you created when you signed up for Unity.
- Plug your iPhone or iPad plugged into your computer.
- Click on the Play button located at the top left portion of the screen.
- Unity will now compile your project.
- Using your phone camera, bring a stationary object into view on your device screen. You will see point clouds superimposed in AR across the object. This is your app working.
Congratulations! You just built your first augmented reality app using one of the most powerful AR tools on the market — the Apple ARKit. Admittedly, the point cloud formation created by your app is not a high-resolution 3D point cloud, but it demonstrates the process of building an AR app for the iPhone and iPad, and it introduces you to the power of ARKit.
How AppReal-VR Can Help?
Let’s face it. You are not interested in learning how to develop augmented reality apps for iPhone or iPad. You are interested in developing a money-generating AR product with the latest AR features to wow the market.
The example we have shown is but a greatly simplified view of what ARKit is capable of producing. In the real world, your ideas are, no doubt, greater. AppReal-VR is in the business of bringing great AR ideas to reality. We offer world-class outsourcing services for the mobile app market, and we are experts in AR technology.
From basic augmented reality iPhone apps to 3D gaming to complex AR applications, we have the expertise to bring your project to life. With six R&D labs across Western Europe, we are well-positioned to serve you efficiently, regardless of your location.
Why not call us today for a free Quote?