Add BeaconsInSpace to your iOS app
The guide below will get you setup with full functionality in 9 minutes.
BeaconsInSpace uses Cocoapods for installs. If you would like to manually install our SDK please download the latest version.
Note: For manual installs, after you have added the BeaconsInSpace.framework to your Xcode project, you must navigate to Build Settings > Linking > Other Linker Flags and add "-ObjC".
1. Get setup
Here's what you'll need before installing the SDK:
A test beacon.
Register test beacons in Mission Control. You can also simulate a beacon using JetFuel
our utility and demo app.
1 iPhone (4S or newer) or iPad (3rd gen. or newer) with iOS 7+, to run your app.
1 Mac computer with Xcode.
2. Install CocoaPod
To run the CocoaPod, open your terminal and navigate to your apps Xcode project.
If you haven't already created a Podfile for your application, create one with:
Next, open the Podfile for your app and enter:
Save the file and run:
This creates an .xcworkspace file for your application. Use this file for all future development on your application.
3. (Optional) Add Swift bridging header
If you are using Swift you will need to add the bridging header.
First, add a header file to your project, named "[MyProjectName]-Bridging-Header.h". This will be the single header file where you import any Objective-C code you want your Swift code to have access to.
Next, in your project build settings, find Swift Compiler – Code Generation, and next to Objective-C Bridging Header add the path to your bridging header file from the project’s root folder. For example, this could be "MyProject/MyProject-Bridging-Header.h" or simply "MyProject-Bridging-Header.h" if the file lives in the project root folder.
Lastly, add your #import statements to this file, and your classes will now be available in your Swift code without any extra import statements.
Note: You only need one bridging header.
4. Setup the beacon manager
In the AppDelegate.m put the following in your import statements:
In the application:didFinishLaunchingWithOptions: method place the following code:
This sets up the beaconManager, which will automatically connect you with your test beacons and subscription beacons with BeaconsInSpace.
5. Authorize Location Services
BeaconsInSpace uses background location monitoring to detect when users are near a beacon. In order to use location services, go to the info.plist and put in the Key "NSLocationAlwaysUsageDescription", and for the String Value enter the message you'd like to display to users when asking for their location.
The BeaconsInSpace beaconManager will handle asking for permission once this is set.
6. Setup the delegate
To implement the <BeaconsInSpaceDelegate>
in the ViewController.m simply add the following to your existing import statements:
Then, next to your interface header enter the following:
Lastly, in your viewDidLoad method enter the following:
That's all you need to get going with the BeaconsInSpace platform.
7. Add the AdSupport.framework
Before you submit your app, please make sure to include the AdSupport.framework in your project. The BeaconsInSpace SDK requires this framework in order to run properly.
8. Submitting to the App Store
Before submitting to the App Store please be aware that BeaconsInSpace collects the IDFA. When you get asked, "Does this app use the Advertising Identifier (IDFA)?" on this page, please make sure to check the following three boxes:
- “Attribute this app installation to a previously served advertisement”
- “Attribute an action taken within this app to a previously served advertisement”
- “I, YOUR_NAME, confirm that this app, and any third party…”
Note: please do not check the box labeled ““Serve advertisements within the app” unless you display ads or already have a standard process of checking this box and collecting the IDFA.
Sample: We share data we collect about you including unique identification numbers associated with mobile devices or through its API (including, for example, a Unique ID for Advertisers ("IDFA"), Unique ID for Vendors ("IDFV"), Google Ad ID, or Windows Advertising ID), mobile carrier, device type, model and manufacturer, mobile device operating system brand and model, battery life, and, depending on the user’s mobile device settings, the geographical location data, including GPS coordinates (e.g. latitude and/or longitude) or similar information regarding the location of the mobile device (“User Data”) with our third party partners, that enables us to provide you with information, advertisements, or offers specific to your location and interests.
By accepting our terms of service, you consent to the collection, storage and processing of your data by our third party partners for the purposes of: (i) providing or improving their services; (ii) enabling third parties to assist us and the retailer and venues (in which the beacons are located) in better serving and understanding our users; and (iii) sharing your data with third parties so they can provide or enable the provision of content, offers or other marketing solutions that may be of interest to you. You also consent to having your data transferred to and processed in the United States or any other jurisdiction in which our third party partners or their parent, subsidiaries, affiliates, service providers or partners maintain facilities. If you do not consent to the collection and transfer of the aforementioned data through the identification of your mobile device, we recommend that you: (a) delete our app or adjust the in-app settings of the app; or (b) opt out of sharing your mobile advertiser ID by limiting ad tracking on the device. For iOS, navigate to your Settings > Select Privacy > Select Advertising > Enable the “Limit Ad Tracking” setting. For Android, open your Google Settings app > Ads > Enable “Opt out of interest-based advertising. For more information on specific opt-out choices, please visit: http://www.networkadvertising.org/mobile-choices.