Search code examples
ioscore-locationios14apple-appclips

Multiple Physical Locations for AppClip


I am developing an AppClip that detects the user's physical location to display the app clip. Apple mentioned a piece of code here:

 func location(from url:URL) -> CLRegion? {
   let coordinates = CLLocationCoordinate2D(latitude: 37.334722,
                                            longitude: 122.008889)
   return CLCircularRegion(center: coordinates,
                                   radius: 100,
                                   identifier: "Apple Park")
 }

My question is, is it possible to add multiple locations since my app needs several museums' location to display the AppClip?


Solution

  • Something basic to understand - App Clips are totally not dependant on location services.

    More than that - an App Clip doesn't have access to the device location. The App Clip CANNOT ask 'where am I?'.

    The App Clip CAN ask 'Am I at this location?' - just to make sure the QR code for the Boston branch is indeed scanned in Boston.

    The experiences are not triggered by location - the only location base for the experiences is a location set in Apple Maps. As you as can spread locations in the Apple Maps for your customers, all of their experiences will show up.

    The code you quoted is how to define the radius in which App Clip asks 'Am I in this radius?'

    If you define separate QR code for example for each museum:

    https://museums.com/nyc/123 https://museums.com/london/356 https://museums.com/paris/789

    You should use the URL to understand which radius you should define in the quoted code.