# How To Make An App Like Pokemon Go

**URL:** <https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673>\
**Category:** 🎓 Courses & Articles\
**Created:** [February 27, 2017, 2:00pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673 "2017-02-27T14:00:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [February 27, 2017, 2:00pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/1 "2017-02-27T14:00:59Z")

</div>

In this tutorial, you'll learn how to make an app like Pokemon Go. You'll learn how to use augmented reality and location services to get gamers outdoors!

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/725-how-to-make-an-app-like-pokemon-go](https://www.raywenderlich.com/725-how-to-make-an-app-like-pokemon-go)

---

<div class="post-metadata">

**Author:** ![flexmcpee](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/flexmcpee/32/73273_2.png) [@flexmcpee](https://forums.kodeco.com/u/flexmcpee)\
**Post date:** [March 1, 2017, 1:55pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/2 "2017-03-01T13:55:54Z")

</div>

Awesome tutorial. I just bashed it out now and it looks are works great. Not used SceneKit before until now.

---

<div class="post-metadata">

**Author:** ![sunlite](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sunlite/32/81494_2.png) [@sunlite](https://forums.kodeco.com/u/sunlite)\
**Post date:** [March 2, 2017, 12:39pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/3 "2017-03-02T12:39:49Z")

</div>

thanks pierredrks so much for this great tutorial! Your Demo runs on my device but cannot find the 3 red markers, though I replaced the location data in your Demo source code, which is near my own location.

And when I walk with my iPhone running your Demo, even though I pass the 3 places that quite near the location data, the video preview doesnot show. ( I know the 3 places that the location data represent.)  
I also found that, after running your Demo, I cannot find your Demo App in " Private — Camera ".  
Please help, thanks!

---

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [March 2, 2017, 1:28pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/4 "2017-03-02T13:28:18Z")

</div>

Hi sunlite,

i checked the final project and for me it works. Is it possible that you mixed latitude and longitude for your places?  
The app will only be visible inside Private/Camera after it tried to access the camera.

---

<div class="post-metadata">

**Author:** ![sunlite](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sunlite/32/81494_2.png) [@sunlite](https://forums.kodeco.com/u/sunlite)\
**Post date:** [March 3, 2017, 2:10am UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/6 "2017-03-03T02:10:06Z")

</div>

It works 🙂 Sorry that I mixed the data before.

---

<div class="post-metadata">

**Author:** ![kmkxcoder](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kmkxcoder/32/102075_2.png) [@kmkxcoder](https://forums.kodeco.com/u/kmkxcoder)\
**Post date:** [March 3, 2017, 3:46am UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/7 "2017-03-03T03:46:35Z")

</div>

Hey @pierredrks. Awesome tutorial. One quick question, though I have not executed this tutorial myself, I would like to know what all the things to be considered If I want to show a real time rendering of a sub-surface materials(pipes/ cables etc) provided its GIS data? .  
Am talking about something like this [http://www.grintec.com/uploads/images/gallery/40/Augview-im-Einsatz-img001.jpg](http://www.grintec.com/uploads/images/gallery/40/Augview-im-Einsatz-img001.jpg)

Pic Source - Google

---

<div class="post-metadata">

**Author:** ![jennysmith](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jennysmith/32/70556_2.png) [@jennysmith](https://forums.kodeco.com/u/jennysmith)\
**Post date:** [March 3, 2017, 6:09am UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/8 "2017-03-03T06:09:14Z")

</div>

Hi pierredrks,  
This is one of the best article which i have seen.  
Informative and useful.

Thank you for sharing.

---

<div class="post-metadata">

**Author:** ![ron\_cookson](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ron_cookson/32/75851_2.png) [@ron\_cookson](https://forums.kodeco.com/u/ron_cookson)\
**Post date:** [March 3, 2017, 2:35pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/9 "2017-03-03T14:35:57Z")

</div>

Hello Perredrks,

Really enjoyed the tutorial. Well written and have learned a lot.

Thanks,

Ron Cookson

---

<div class="post-metadata">

**Author:** ![sunlite](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sunlite/32/81494_2.png) [@sunlite](https://forums.kodeco.com/u/sunlite)\
**Post date:** [March 3, 2017, 3:24pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/10 "2017-03-03T15:24:54Z")

</div>

Hello Perredrks, I want to get rid of hard-coded enemies, but donot want to use a back-end data provider firstly. I noticed your suggestion : " For example, you could create some random locations around your current position, use the PlacesLoader from our original Augmented Reality tutorial,". and I studied your original Augmented Reality tutorial link, but still cannot get a method to create some random locations around my current position, would you please be more specified on it?

thanks!

---

<div class="post-metadata">

**Author:** ![ron\_cookson](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ron_cookson/32/75851_2.png) [@ron\_cookson](https://forums.kodeco.com/u/ron_cookson)\
**Post date:** [March 4, 2017, 11:02pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/11 "2017-03-04T23:02:38Z")

</div>

Hi. The app seems to have worked once and now I’m getting the errors below. Note ‘Unable to retrieve CarrierName’ and ‘unexpectedly found nil while unwrapping an optional value’

Latest version of Xcode and iPhone 6 running latest update.Help!!!

2017-03-04 14:57:36.802658 AR\_Hunt[9912:3705558] [DYMTLInitPlatform] platform initialization successful  
2017-03-04 14:57:37.025260 AR\_Hunt[9912:3705476] Metal GPU Frame Capture Enabled  
2017-03-04 14:57:37.026330 AR\_Hunt[9912:3705476] Metal API Validation Enabled  
2017-03-04 14:57:37.460738 AR\_Hunt[9912:3705546] [LogMessageLogging] 6.1 Unable to retrieve CarrierName. CTError: domain-2, code-5, errStr:((os/kern) failure)  
2017-03-04 14:57:52.869064 AR\_Hunt[9912:3705476] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles  
2017-03-04 14:57:52.875379 AR\_Hunt[9912:3705476] [MC] Reading from public effective user settings.  
fatal error: unexpectedly found nil while unwrapping an Optional value  
2017-03-04 14:57:53.423061 AR\_Hunt[9912:3705476] fatal error: unexpectedly found nil while unwrapping an Optional value  
Thanks Ron

---

<div class="post-metadata">

**Author:** ![ron\_cookson](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ron_cookson/32/75851_2.png) [@ron\_cookson](https://forums.kodeco.com/u/ron_cookson)\
**Post date:** [March 4, 2017, 11:04pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/12 "2017-03-04T23:04:17Z")

</div>

Also, forgot that the error above is from the final project with the following long lat changes:  
func setupLocations() {  
let firstTarget = ARItem(itemDescription: “Jake”, location: CLLocation(latitude: 34.4134, longitude: -118.4820), itemNode: nil)  
//let firstTarget = ARItem(itemDescription: “Jake”, location: CLLocation(latitude: 34.1548, longitude: -118.6474, itemNode: nil)  
targets.append(firstTarget)

```
let secondTarget = ARItem(itemDescription: "Corey", location: CLLocation(latitude: 34.4134, longitude: -118.4824), itemNode: nil)
//let secondTarget = ARItem(itemDescription: "Corey", location: CLLocation(latitude: 34.1548, longitude: -118.6476), itemNode: nil)
targets.append(secondTarget)

let thirdTarget = ARItem(itemDescription: "Justin", location: CLLocation(latitude: 34.4134, longitude: -118.4829), itemNode: nil)
//let thirdTarget = ARItem(itemDescription: "Justin", location: CLLocation(latitude: 34.1548, longitude: -118.6478, itemNode: nil)
targets.append(thirdTarget)

for item in targets {
  let annotation = MapAnnotation(location: item.location.coordinate, item: item)
  self.mapView.addAnnotation(annotation)
}

```

}

thanks,

Ron

---

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [March 5, 2017, 12:16pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/13 "2017-03-05T12:16:44Z")

</div>

@sunlite No problem i had the same a few weeks ago when i bought a new telescope. For your second question: Have a look at `getDummyAnnotations` in [https://github.com/DanijelHuis/HDAugmentedReality/blob/master/HDAugmentedRealityDemo/ViewController.swift](https://github.com/DanijelHuis/HDAugmentedReality/blob/master/HDAugmentedRealityDemo/ViewController.swift)

@kmkxcoder Showing the pipes shouldn’t be too hard. Our SceneKit book may help you. The hard stuff is to take the inaccuracy of the position (GPS signal) into account. Here can an object detection algorithm help.

@ron_cookson This doesn’t seem to be related with the final project, it looks more like there is a settings problem. Can you add an exception breakpoint? Open the Breakpoint Navigator (cmd + 7) and click the + sign at the bottom and `Exception Breakpoint...` and run again. The execution should stop at the line that caused the exception.

---

<div class="post-metadata">

**Author:** ![ron\_cookson](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ron_cookson/32/75851_2.png) [@ron\_cookson](https://forums.kodeco.com/u/ron_cookson)\
**Post date:** [March 5, 2017, 8:17pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/14 "2017-03-05T20:17:11Z")

</div>

Thanks for the quick response. Did what you said. The breakpoint line is in the MapViewController: extension MapViewController: MKMapViewDelegate

```
        self.present(viewController, animated: true, completion: nil)

```

Ron

---

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [March 6, 2017, 12:12pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/15 "2017-03-06T12:12:33Z")

</div>

Ok, then the next step is to add a breakpoint to this line and check if `storyboard` and /or `viewController` is nil. If `viewController` is nil, open the storyboard and select **View Controller Scene** in the **Identity Inspector** check if the **Storyboard ID** is the same as in the code

`if let viewController = storyboard.instantiateViewController(withIdentifier: "ARViewController") as? ViewController {`

---

<div class="post-metadata">

**Author:** ![sunlite](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sunlite/32/81494_2.png) [@sunlite](https://forums.kodeco.com/u/sunlite)\
**Post date:** [March 7, 2017, 4:21pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/16 "2017-03-07T16:21:45Z")

</div>

thanks pierredrks so much!  
When I use " locationManager.location?.coordinate.latitude " and " locationManager.location?.coordinate.longitude " to replace the hard coded " 45.554833 " and " 18.695433 " as follows, there are errors like : " fatal error: unexpectedly found nil while unwrapping an Optional value", please help, thanks!  
override func viewDidLoad() {  
super.viewDidLoad()

```
mapView.userTrackingMode = MKUserTrackingMode.followWithHeading

if CLLocationManager.authorizationStatus() == .notDetermined {
  locationManager.requestWhenInUseAuthorization()
  
  let lat = locationManager.location?.coordinate.latitude //45.554833
  let lon = locationManager.location?.coordinate.longitude //18.695433
  let delta = 0.05
  let count = 10
  let dummyAnnotations = getDummyAnnotations(centerLatitude: lat!, centerLongitude: lon!, delta: delta, count: count)
  ......

```

---

<div class="post-metadata">

**Author:** ![ron\_cookson](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ron_cookson/32/75851_2.png) [@ron\_cookson](https://forums.kodeco.com/u/ron_cookson)\
**Post date:** [March 7, 2017, 9:29pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/17 "2017-03-07T21:29:08Z")

</div>

Pierredrks,

I am getting the same error as Sunlite above. I am using the final project download to test . This way the errors did not come from my retyping and adding code as I read the article.

Thanks,

Ron

---

<div class="post-metadata">

**Author:** ![pierredrks](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/pierredrks/32/104353_2.png) [@pierredrks](https://forums.kodeco.com/u/pierredrks)\
**Post date:** [March 9, 2017, 8:05am UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/18 "2017-03-09T08:05:22Z")

</div>

@sunlite i guess that you call this stuff too early, at this time the location manager didn’t start. Use the didUpdateLocation delegate method and create the dummy annotations there.

Btw. your code would only work once, after the user granted permissions the code inside the if statement won’t be executed.

@ron_cookson what is the error you get?

---

<div class="post-metadata">

**Author:** ![kmkxcoder](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kmkxcoder/32/102075_2.png) [@kmkxcoder](https://forums.kodeco.com/u/kmkxcoder)\
**Post date:** [March 10, 2017, 11:09am UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/19 "2017-03-10T11:09:49Z")

</div>

How to lock the Wolf / Dragon’s X and Y axis. It is moving along with the camera instead of staying Z distance from the main camera

---

<div class="post-metadata">

**Author:** ![sunlite](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sunlite/32/81494_2.png) [@sunlite](https://forums.kodeco.com/u/sunlite)\
**Post date:** [March 10, 2017, 11:48am UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/20 "2017-03-10T11:48:20Z")

</div>

Hi pierredrks,  
Shall I Create dummyAnnotation after the sentence " self.userLocation = userLocation.location " below?  
Thanks !

extension MapViewController: MKMapViewDelegate {  
func mapView(\_ mapView: MKMapView, didUpdate userLocation: MKUserLocation) {  
self.userLocation = userLocation.location  
// To Create dummyAnnotation here  
}

---

<div class="post-metadata">

**Author:** ![sunlite](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sunlite/32/81494_2.png) [@sunlite](https://forums.kodeco.com/u/sunlite)\
**Post date:** [March 13, 2017, 12:50pm UTC](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673/21 "2017-03-13T12:50:00Z")

</div>

@pierredrks  
Hi pierredrks,  
Got an error in Swift running at this code: " getRanAnnotations ", stuck here for some days, please help, thanks !:  
" extension MapViewController: MKMapViewDelegate {  
func mapView(\_ mapView: MKMapView, didUpdate userLocation: MKUserLocation) { self.userLocation = userLocation.location  
let lat = self.userLocation?.coordinate.latitude  
let lon = self.userLocation?.coordinate.longitude  
let ranAnnotations = getRanAnnotations(centerLatitude: lat!, centerLongitude: lon!)  
"  
fatal error: unexpectedly found nil while unwrapping an Optional value

libswiftCore.dylib`function signature specialization \<preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead\> of Swift.\_fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt, flags : Swift.UInt32) → Swift.Never:  
0x100611184 \<+0\>: stp x26, x25, [sp, #-80]!  
0x100611188 \<+4\>: stp x24, x23, [sp, #16]  
0x10061118c \<+8\>: stp x22, x21, [sp, #32]  
0x100611190 \<+12\>: stp x20, x19, [sp, #48]  
0x100611194 \<+16\>: stp x29, x30, [sp, #64]  
0x100611198 \<+20\>: add x29, sp, #64 ; =64  
0x10061119c \<+24\>: mov x19, x6  
0x1006111a0 \<+28\>: mov x20, x5  
0x1006111a4 \<+32\>: mov x21, x4k  
0x1006111a8 \<+36\>: mov x22, x3  
0x1006111ac \<+40\>: mov x23, x2  
0x1006111b0 \<+44\>: mov x24, x1  
0x1006111b4 \<+48\>: mov x25, x0  
0x1006111b8 \<+52\>: adr x8, #936936 ; protocol descriptor for Swift.CVarArg + 88  
0x1006111bc \<+56\>: nop  
0x1006111c0 \<+60\>: add x0, x8, #16 ; =16  
0x1006111c4 \<+64\>: movz w1, #0x28  
0x1006111c8 \<+68\>: orr w2, wzr, #0x7  
0x1006111cc \<+72\>: bl 0x1006114b0 ; rt\_swift\_allocObject  
0x1006111d0 \<+76\>: mov x8, x0  
0x1006111d4 \<+80\>: stp x22, x21, [x8, #16]  
0x1006111d8 \<+84\>: strb w20, [x8, #32]  
0x1006111dc \<+88\>: str w19, [x8, #36]  
0x1006111e0 \<+92\>: adr x3, #241008 ; partial apply forwarder for Swift.(\_fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt, flags : Swift.UInt32) → Swift.Never).(closure #2)  
0x1006111e4 \<+96\>: nop  
0x1006111e8 \<+100\>: mov x0, x25  
0x1006111ec \<+104\>: mov x1, x24  
0x1006111f0 \<+108\>: mov x2, x23  
0x1006111f4 \<+112\>: mov x4, x8  
0x1006111f8 \<+116\>: bl 0x100504b80 ; function signature specialization \<preserving fragile attribute, Arg[1] = [Closure Propagated : reabstraction thunk helper from @callee\_owned (@unowned Swift.UnsafeBufferPointer\<Swift.UInt8\>) → () to @callee\_owned (@unowned Swift.UnsafeBufferPointer\<Swift.UInt8\>) → (@out ()), Argument Types : [@callee\_owned (@unowned Swift.UnsafeBufferPointer\<Swift.UInt8\>) → ()]\> of generic specialization \<preserving fragile attribute, ()\> of Swift.StaticString.withUTF8Buffer ((Swift.UnsafeBufferPointer\<Swift.UInt8\>) → A) → A  
 → 0x1006111fc \<+120\>: brk #0x1"

[Next page](https://forums.kodeco.com/t/how-to-make-an-app-like-pokemon-go/26673.md?page=2)
