├── .gitignore ├── License.txt ├── README.md ├── iBeaconDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── xcuserdata │ │ └── cmann.xcuserdatad │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── cmann.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── iBeaconDemo.xcscheme └── iBeaconDemo ├── CSMAppDelegate.h ├── CSMAppDelegate.m ├── CSMBeaconRegion.h ├── CSMBeaconRegion.m ├── CSMHomeViewController.h ├── CSMHomeViewController.m ├── CSMLocationManager.h ├── CSMLocationManager.m ├── CSMLocationUpdateController.h ├── CSMLocationUpdateController.m ├── CSMRootViewController.h ├── CSMRootViewController.m ├── Images.xcassets ├── AppIcon.appiconset │ ├── Contents.json │ ├── Icon_120.png │ ├── Icon_152.png │ └── Icon_76.png └── LaunchImage.launchimage │ └── Contents.json ├── en.lproj └── InfoPlist.strings ├── iBeaconDemo-Info.plist ├── iBeaconDemo-Prefix.pch └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | #CocoaPods 21 | Pods 22 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "{}" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright {yyyy} {name of copyright owner} 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | iBeaconDemo 2 | =========== 3 | 4 | This app provides a basic demo of the new iBeacons API available on iOS 7 and accompanies the blog post iOS Tutorial Series: Core Location Beacons. To run the application requires two iOS 7 devices supporting Bluetooth 4.0. One instance uses CBPeripheralManager to advertise an instance of CLBeaconRegion using the device's Bluetooth LE signal. The other instance monitors for the same defined CLBeaconRegion and displays updates regarding the region state and the user's proximity to the advertised beacon. 5 | -------------------------------------------------------------------------------- /iBeaconDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D573F8E41805C469001004B2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D573F8E31805C469001004B2 /* Foundation.framework */; }; 11 | D573F8E61805C469001004B2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D573F8E51805C469001004B2 /* CoreGraphics.framework */; }; 12 | D573F8E81805C469001004B2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D573F8E71805C469001004B2 /* UIKit.framework */; }; 13 | D573F8EE1805C469001004B2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D573F8EC1805C469001004B2 /* InfoPlist.strings */; }; 14 | D573F8F01805C469001004B2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D573F8EF1805C469001004B2 /* main.m */; }; 15 | D573F8F61805C469001004B2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D573F8F51805C469001004B2 /* Images.xcassets */; }; 16 | D573F91E1805C4A5001004B2 /* CSMAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D573F9181805C4A5001004B2 /* CSMAppDelegate.m */; }; 17 | D573F91F1805C4A5001004B2 /* CSMBeaconRegion.m in Sources */ = {isa = PBXBuildFile; fileRef = D573F9191805C4A5001004B2 /* CSMBeaconRegion.m */; }; 18 | D573F9201805C4A5001004B2 /* CSMHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D573F91A1805C4A5001004B2 /* CSMHomeViewController.m */; }; 19 | D573F9211805C4A5001004B2 /* CSMLocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D573F91B1805C4A5001004B2 /* CSMLocationManager.m */; }; 20 | D573F9221805C4A5001004B2 /* CSMLocationUpdateController.m in Sources */ = {isa = PBXBuildFile; fileRef = D573F91C1805C4A5001004B2 /* CSMLocationUpdateController.m */; }; 21 | D573F9231805C4A5001004B2 /* CSMRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D573F91D1805C4A5001004B2 /* CSMRootViewController.m */; }; 22 | D5A433401808415F00228EFC /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D573F927180601B1001004B2 /* CoreLocation.framework */; }; 23 | D5A433421808417600228EFC /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5A433411808417600228EFC /* CoreBluetooth.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | D573F8E01805C469001004B2 /* iBeaconDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iBeaconDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | D573F8E31805C469001004B2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 29 | D573F8E51805C469001004B2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 30 | D573F8E71805C469001004B2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 31 | D573F8EB1805C469001004B2 /* iBeaconDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iBeaconDemo-Info.plist"; sourceTree = ""; }; 32 | D573F8ED1805C469001004B2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 33 | D573F8EF1805C469001004B2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | D573F8F11805C469001004B2 /* iBeaconDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iBeaconDemo-Prefix.pch"; sourceTree = ""; }; 35 | D573F8F51805C469001004B2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 36 | D573F8FC1805C469001004B2 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 37 | D573F9121805C4A5001004B2 /* CSMAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMAppDelegate.h; sourceTree = ""; }; 38 | D573F9131805C4A5001004B2 /* CSMBeaconRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMBeaconRegion.h; sourceTree = ""; }; 39 | D573F9141805C4A5001004B2 /* CSMHomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMHomeViewController.h; sourceTree = ""; }; 40 | D573F9151805C4A5001004B2 /* CSMLocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMLocationManager.h; sourceTree = ""; }; 41 | D573F9161805C4A5001004B2 /* CSMLocationUpdateController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMLocationUpdateController.h; sourceTree = ""; }; 42 | D573F9171805C4A5001004B2 /* CSMRootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSMRootViewController.h; sourceTree = ""; }; 43 | D573F9181805C4A5001004B2 /* CSMAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSMAppDelegate.m; sourceTree = ""; }; 44 | D573F9191805C4A5001004B2 /* CSMBeaconRegion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSMBeaconRegion.m; sourceTree = ""; }; 45 | D573F91A1805C4A5001004B2 /* CSMHomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSMHomeViewController.m; sourceTree = ""; }; 46 | D573F91B1805C4A5001004B2 /* CSMLocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSMLocationManager.m; sourceTree = ""; }; 47 | D573F91C1805C4A5001004B2 /* CSMLocationUpdateController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSMLocationUpdateController.m; sourceTree = ""; }; 48 | D573F91D1805C4A5001004B2 /* CSMRootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSMRootViewController.m; sourceTree = ""; }; 49 | D573F927180601B1001004B2 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 50 | D5A433411808417600228EFC /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | D573F8DD1805C469001004B2 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | D5A433421808417600228EFC /* CoreBluetooth.framework in Frameworks */, 59 | D5A433401808415F00228EFC /* CoreLocation.framework in Frameworks */, 60 | D573F8E61805C469001004B2 /* CoreGraphics.framework in Frameworks */, 61 | D573F8E81805C469001004B2 /* UIKit.framework in Frameworks */, 62 | D573F8E41805C469001004B2 /* Foundation.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | D573F8D71805C469001004B2 = { 70 | isa = PBXGroup; 71 | children = ( 72 | D573F8E91805C469001004B2 /* iBeaconDemo */, 73 | D573F8E21805C469001004B2 /* Frameworks */, 74 | D573F8E11805C469001004B2 /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | D573F8E11805C469001004B2 /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | D573F8E01805C469001004B2 /* iBeaconDemo.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | D573F8E21805C469001004B2 /* Frameworks */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | D5A433411808417600228EFC /* CoreBluetooth.framework */, 90 | D573F927180601B1001004B2 /* CoreLocation.framework */, 91 | D573F8E31805C469001004B2 /* Foundation.framework */, 92 | D573F8E51805C469001004B2 /* CoreGraphics.framework */, 93 | D573F8E71805C469001004B2 /* UIKit.framework */, 94 | D573F8FC1805C469001004B2 /* XCTest.framework */, 95 | ); 96 | name = Frameworks; 97 | sourceTree = ""; 98 | }; 99 | D573F8E91805C469001004B2 /* iBeaconDemo */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | D573F9121805C4A5001004B2 /* CSMAppDelegate.h */, 103 | D573F9181805C4A5001004B2 /* CSMAppDelegate.m */, 104 | D573F9171805C4A5001004B2 /* CSMRootViewController.h */, 105 | D573F91D1805C4A5001004B2 /* CSMRootViewController.m */, 106 | D573F9141805C4A5001004B2 /* CSMHomeViewController.h */, 107 | D573F91A1805C4A5001004B2 /* CSMHomeViewController.m */, 108 | D573F9161805C4A5001004B2 /* CSMLocationUpdateController.h */, 109 | D573F91C1805C4A5001004B2 /* CSMLocationUpdateController.m */, 110 | D573F9151805C4A5001004B2 /* CSMLocationManager.h */, 111 | D573F91B1805C4A5001004B2 /* CSMLocationManager.m */, 112 | D573F9131805C4A5001004B2 /* CSMBeaconRegion.h */, 113 | D573F9191805C4A5001004B2 /* CSMBeaconRegion.m */, 114 | D573F8F51805C469001004B2 /* Images.xcassets */, 115 | D573F8EA1805C469001004B2 /* Supporting Files */, 116 | ); 117 | path = iBeaconDemo; 118 | sourceTree = ""; 119 | }; 120 | D573F8EA1805C469001004B2 /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | D573F8EB1805C469001004B2 /* iBeaconDemo-Info.plist */, 124 | D573F8EC1805C469001004B2 /* InfoPlist.strings */, 125 | D573F8EF1805C469001004B2 /* main.m */, 126 | D573F8F11805C469001004B2 /* iBeaconDemo-Prefix.pch */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | /* End PBXGroup section */ 132 | 133 | /* Begin PBXNativeTarget section */ 134 | D573F8DF1805C469001004B2 /* iBeaconDemo */ = { 135 | isa = PBXNativeTarget; 136 | buildConfigurationList = D573F90C1805C46A001004B2 /* Build configuration list for PBXNativeTarget "iBeaconDemo" */; 137 | buildPhases = ( 138 | D573F8DC1805C469001004B2 /* Sources */, 139 | D573F8DD1805C469001004B2 /* Frameworks */, 140 | D573F8DE1805C469001004B2 /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = iBeaconDemo; 147 | productName = iBeaconDemo; 148 | productReference = D573F8E01805C469001004B2 /* iBeaconDemo.app */; 149 | productType = "com.apple.product-type.application"; 150 | }; 151 | /* End PBXNativeTarget section */ 152 | 153 | /* Begin PBXProject section */ 154 | D573F8D81805C469001004B2 /* Project object */ = { 155 | isa = PBXProject; 156 | attributes = { 157 | CLASSPREFIX = CSM; 158 | LastUpgradeCheck = 0500; 159 | ORGANIZATIONNAME = "Christopher Mann"; 160 | }; 161 | buildConfigurationList = D573F8DB1805C469001004B2 /* Build configuration list for PBXProject "iBeaconDemo" */; 162 | compatibilityVersion = "Xcode 3.2"; 163 | developmentRegion = English; 164 | hasScannedForEncodings = 0; 165 | knownRegions = ( 166 | en, 167 | ); 168 | mainGroup = D573F8D71805C469001004B2; 169 | productRefGroup = D573F8E11805C469001004B2 /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | D573F8DF1805C469001004B2 /* iBeaconDemo */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | D573F8DE1805C469001004B2 /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | D573F8EE1805C469001004B2 /* InfoPlist.strings in Resources */, 184 | D573F8F61805C469001004B2 /* Images.xcassets in Resources */, 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | /* End PBXResourcesBuildPhase section */ 189 | 190 | /* Begin PBXSourcesBuildPhase section */ 191 | D573F8DC1805C469001004B2 /* Sources */ = { 192 | isa = PBXSourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | D573F91E1805C4A5001004B2 /* CSMAppDelegate.m in Sources */, 196 | D573F9201805C4A5001004B2 /* CSMHomeViewController.m in Sources */, 197 | D573F8F01805C469001004B2 /* main.m in Sources */, 198 | D573F9221805C4A5001004B2 /* CSMLocationUpdateController.m in Sources */, 199 | D573F91F1805C4A5001004B2 /* CSMBeaconRegion.m in Sources */, 200 | D573F9211805C4A5001004B2 /* CSMLocationManager.m in Sources */, 201 | D573F9231805C4A5001004B2 /* CSMRootViewController.m in Sources */, 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | }; 205 | /* End PBXSourcesBuildPhase section */ 206 | 207 | /* Begin PBXVariantGroup section */ 208 | D573F8EC1805C469001004B2 /* InfoPlist.strings */ = { 209 | isa = PBXVariantGroup; 210 | children = ( 211 | D573F8ED1805C469001004B2 /* en */, 212 | ); 213 | name = InfoPlist.strings; 214 | sourceTree = ""; 215 | }; 216 | /* End PBXVariantGroup section */ 217 | 218 | /* Begin XCBuildConfiguration section */ 219 | D573F90A1805C46A001004B2 /* Debug */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | ALWAYS_SEARCH_USER_PATHS = NO; 223 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 224 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 225 | CLANG_CXX_LIBRARY = "libc++"; 226 | CLANG_ENABLE_MODULES = YES; 227 | CLANG_ENABLE_OBJC_ARC = YES; 228 | CLANG_WARN_BOOL_CONVERSION = YES; 229 | CLANG_WARN_CONSTANT_CONVERSION = YES; 230 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 231 | CLANG_WARN_EMPTY_BODY = YES; 232 | CLANG_WARN_ENUM_CONVERSION = YES; 233 | CLANG_WARN_INT_CONVERSION = YES; 234 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 235 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 236 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 237 | COPY_PHASE_STRIP = NO; 238 | GCC_C_LANGUAGE_STANDARD = gnu99; 239 | GCC_DYNAMIC_NO_PIC = NO; 240 | GCC_OPTIMIZATION_LEVEL = 0; 241 | GCC_PREPROCESSOR_DEFINITIONS = ( 242 | "DEBUG=1", 243 | "$(inherited)", 244 | ); 245 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 246 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 247 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 248 | GCC_WARN_UNDECLARED_SELECTOR = YES; 249 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 250 | GCC_WARN_UNUSED_FUNCTION = YES; 251 | GCC_WARN_UNUSED_VARIABLE = YES; 252 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 253 | ONLY_ACTIVE_ARCH = YES; 254 | SDKROOT = iphoneos; 255 | TARGETED_DEVICE_FAMILY = "1,2"; 256 | }; 257 | name = Debug; 258 | }; 259 | D573F90B1805C46A001004B2 /* Release */ = { 260 | isa = XCBuildConfiguration; 261 | buildSettings = { 262 | ALWAYS_SEARCH_USER_PATHS = NO; 263 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 264 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 265 | CLANG_CXX_LIBRARY = "libc++"; 266 | CLANG_ENABLE_MODULES = YES; 267 | CLANG_ENABLE_OBJC_ARC = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_EMPTY_BODY = YES; 272 | CLANG_WARN_ENUM_CONVERSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 275 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 276 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 277 | COPY_PHASE_STRIP = YES; 278 | ENABLE_NS_ASSERTIONS = NO; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 287 | SDKROOT = iphoneos; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Release; 292 | }; 293 | D573F90D1805C46A001004B2 /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 297 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 298 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 299 | GCC_PREFIX_HEADER = "iBeaconDemo/iBeaconDemo-Prefix.pch"; 300 | INFOPLIST_FILE = "iBeaconDemo/iBeaconDemo-Info.plist"; 301 | PRODUCT_NAME = "$(TARGET_NAME)"; 302 | WRAPPER_EXTENSION = app; 303 | }; 304 | name = Debug; 305 | }; 306 | D573F90E1805C46A001004B2 /* Release */ = { 307 | isa = XCBuildConfiguration; 308 | buildSettings = { 309 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 310 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 311 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 312 | GCC_PREFIX_HEADER = "iBeaconDemo/iBeaconDemo-Prefix.pch"; 313 | INFOPLIST_FILE = "iBeaconDemo/iBeaconDemo-Info.plist"; 314 | PRODUCT_NAME = "$(TARGET_NAME)"; 315 | WRAPPER_EXTENSION = app; 316 | }; 317 | name = Release; 318 | }; 319 | /* End XCBuildConfiguration section */ 320 | 321 | /* Begin XCConfigurationList section */ 322 | D573F8DB1805C469001004B2 /* Build configuration list for PBXProject "iBeaconDemo" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | D573F90A1805C46A001004B2 /* Debug */, 326 | D573F90B1805C46A001004B2 /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | D573F90C1805C46A001004B2 /* Build configuration list for PBXNativeTarget "iBeaconDemo" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | D573F90D1805C46A001004B2 /* Debug */, 335 | D573F90E1805C46A001004B2 /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | /* End XCConfigurationList section */ 341 | }; 342 | rootObject = D573F8D81805C469001004B2 /* Project object */; 343 | } 344 | -------------------------------------------------------------------------------- /iBeaconDemo.xcodeproj/project.xcworkspace/xcuserdata/cmann.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | IssueFilterStyle 12 | ShowActiveSchemeOnly 13 | LiveSourceIssuesEnabled 14 | 15 | SnapshotAutomaticallyBeforeSignificantChanges 16 | 17 | SnapshotLocationStyle 18 | Default 19 | 20 | 21 | -------------------------------------------------------------------------------- /iBeaconDemo.xcodeproj/xcuserdata/cmann.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /iBeaconDemo.xcodeproj/xcuserdata/cmann.xcuserdatad/xcschemes/iBeaconDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSMAppDelegate.h 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSMRootViewController.h" 11 | 12 | typedef NS_ENUM(NSUInteger, CSMApplicationMode) { 13 | CSMApplicationModePeripheral = 0, 14 | CSMApplicationModeRegionMonitoring 15 | }; 16 | 17 | #define kUniqueRegionIdentifier @"iBeacon Demo" 18 | 19 | #define kAppTintColor [UIColor colorWithRed:0.12 green:0.50 blue:0.15 alpha:1.0] 20 | 21 | 22 | @interface CSMAppDelegate : UIResponder 23 | 24 | @property (nonatomic, strong) UIWindow *window; 25 | 26 | @property (nonatomic, strong) CSMRootViewController *rootViewController; 27 | 28 | @property (nonatomic, strong) NSUUID *myUUID; 29 | 30 | @property (nonatomic, assign) CSMApplicationMode applicationMode; 31 | 32 | + (CSMAppDelegate*)appDelegate; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSMAppDelegate.m 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import "CSMAppDelegate.h" 10 | 11 | #define kMyStoreNumber 1 12 | #define kWeeklySpecialItemNumber 1 13 | 14 | 15 | @implementation CSMAppDelegate 16 | 17 | + (CSMAppDelegate*)appDelegate { 18 | return (CSMAppDelegate*)[UIApplication sharedApplication].delegate; 19 | } 20 | 21 | - (NSUUID*)myUUID { 22 | if (!_myUUID) { 23 | // generate unique identifier 24 | _myUUID = [[NSUUID alloc] initWithUUIDString:@"10D39AE7-020E-4467-9CB2-DD36366F899D"]; 25 | } 26 | return _myUUID; 27 | } 28 | 29 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 30 | self.rootViewController = [[CSMRootViewController alloc] init]; 31 | 32 | // define navbar appearance 33 | [[UINavigationBar appearance] setBarTintColor:kAppTintColor]; 34 | [[UINavigationBar appearance] setTintColor:[UIColor blackColor]]; 35 | [[UINavigationBar appearance] setBarStyle:UIBarStyleBlack]; 36 | 37 | // set status bar style 38 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 39 | 40 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 41 | self.window.rootViewController = self.rootViewController; 42 | self.window.backgroundColor = [UIColor whiteColor]; 43 | self.window.tintColor = kAppTintColor; 44 | [self.window makeKeyAndVisible]; 45 | 46 | return YES; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMBeaconRegion.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSMBeaconRegion.h 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/16/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CSMBeaconRegion : CLBeaconRegion 12 | 13 | + (instancetype)targetRegion; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMBeaconRegion.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSMBeaconRegion.m 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/16/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import "CSMBeaconRegion.h" 10 | #import "CSMAppDelegate.h" 11 | 12 | 13 | static CSMBeaconRegion *_sharedInstance = nil; 14 | 15 | @implementation CSMBeaconRegion 16 | 17 | + (instancetype)targetRegion { 18 | static dispatch_once_t onceToken; 19 | dispatch_once(&onceToken, ^{ 20 | _sharedInstance = [[CSMBeaconRegion alloc] init]; 21 | }); 22 | return _sharedInstance; 23 | } 24 | 25 | - (id)init { 26 | 27 | // initialize a new CLBeaconRegion with application-specific UUID and human-readable identifier 28 | self = [super initWithProximityUUID:[CSMAppDelegate appDelegate].myUUID 29 | identifier:kUniqueRegionIdentifier]; 30 | 31 | if (self) { 32 | self.notifyEntryStateOnDisplay = NO; // only notify user if app is active 33 | self.notifyOnEntry = NO; // don't notify user on region entrance 34 | self.notifyOnExit = YES; // notify user on region exit 35 | } 36 | return self; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMHomeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSMHomeViewController.h 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CSMHomeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMHomeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSMHomeViewController.m 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import "CSMHomeViewController.h" 10 | #import "CSMLocationUpdateController.h" 11 | #import "CSMAppDelegate.h" 12 | 13 | #define kHorizontalPadding 20 14 | #define kVerticalPadding 10 15 | 16 | @interface CSMHomeViewController () 17 | 18 | @property (nonatomic, strong) UILabel *instructionLabel; 19 | @property (nonatomic, strong) UISegmentedControl *segmentedControl; 20 | 21 | @end 22 | 23 | @implementation CSMHomeViewController 24 | 25 | - (id)init { 26 | self = [super init]; 27 | if (self) { 28 | 29 | } 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | self.title = @"iBeacons Demo"; 37 | self.view.backgroundColor = [UIColor whiteColor]; 38 | 39 | self.instructionLabel = [UILabel new]; 40 | self.instructionLabel.textAlignment = NSTextAlignmentCenter; 41 | self.instructionLabel.preferredMaxLayoutWidth = self.view.frame.size.width - 2*kHorizontalPadding; 42 | self.instructionLabel.numberOfLines = 0; 43 | self.instructionLabel.text = @"Select the mode you would like to use for this device:"; 44 | self.instructionLabel.translatesAutoresizingMaskIntoConstraints = NO; 45 | [self.view addSubview:self.instructionLabel]; 46 | 47 | self.segmentedControl = [[UISegmentedControl alloc] initWithItems:@[@"iBeacon",@"Region Monitoring"]]; 48 | self.segmentedControl.momentary = YES; 49 | self.segmentedControl.translatesAutoresizingMaskIntoConstraints = NO; 50 | [self.segmentedControl addTarget:self action:@selector(handleToggle:) forControlEvents:UIControlEventValueChanged]; 51 | [self.view addSubview:self.segmentedControl]; 52 | 53 | // define auto layout constraints 54 | NSDictionary *constraintMetrics = @{@"horizontalPadding" : @kHorizontalPadding, 55 | @"verticalPadding" : @(5*kVerticalPadding), 56 | @"verticalSpacing" : @(2*kVerticalPadding)}; 57 | NSDictionary *constraintViews = @{@"label" : self.instructionLabel, 58 | @"segmentedControl" : self.segmentedControl, 59 | @"topGuide" : self.topLayoutGuide}; 60 | 61 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-horizontalPadding-[label]-horizontalPadding-|" 62 | options:0 63 | metrics:constraintMetrics 64 | views:constraintViews]]; 65 | 66 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-horizontalPadding-[segmentedControl]-horizontalPadding-|" 67 | options:0 68 | metrics:constraintMetrics 69 | views:constraintViews]]; 70 | 71 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[topGuide]-verticalPadding-[label]-verticalSpacing-[segmentedControl(==60)]-(>=verticalPadding)-|" 72 | options:0 73 | metrics:constraintMetrics 74 | views:constraintViews]]; 75 | } 76 | 77 | - (void)handleToggle:(id)sender { 78 | 79 | CSMLocationUpdateController *monitoringController; 80 | 81 | if (self.segmentedControl.selectedSegmentIndex == 0) { 82 | 83 | // initiate iBeacon broadcasting mode 84 | monitoringController = [[CSMLocationUpdateController alloc] initWithLocationMode:CSMApplicationModePeripheral]; 85 | 86 | } else { 87 | 88 | // initate peripheral iBeacon monitoring mode 89 | monitoringController = [[CSMLocationUpdateController alloc] initWithLocationMode:CSMApplicationModeRegionMonitoring]; 90 | } 91 | 92 | // present update controller 93 | UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:monitoringController]; 94 | [self presentViewController:navController animated:YES completion:NULL]; 95 | } 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMLocationManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSMLocationManager.h 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface CSMLocationManager : NSObject 14 | 15 | + (instancetype)sharedManager; 16 | 17 | - (void)initializePeripheralManager; 18 | 19 | - (void)initializeRegionMonitoring; 20 | 21 | - (void)stopMonitoringForRegion:(CLBeaconRegion*)region; 22 | 23 | - (void)stopAdvertisingBeacon; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMLocationManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSMLocationManager.m 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import "CSMLocationManager.h" 10 | #import "CSMLocationUpdateController.h" 11 | #import "CSMAppDelegate.h" 12 | #import "CSMBeaconRegion.h" 13 | #import 14 | 15 | #define kLocationUpdateNotification @"updateNotification" 16 | 17 | @interface CSMLocationManager () 18 | 19 | @property (nonatomic, strong) CLLocationManager *locationManager; 20 | @property (nonatomic, strong) CBPeripheralManager *peripheralManager; 21 | @property (nonatomic, strong) NSDictionary *peripheralData; 22 | @property (nonatomic, assign) BOOL isMonitoringRegion; 23 | @property (nonatomic, assign) BOOL didShowEntranceNotifier; 24 | @property (nonatomic, assign) BOOL didShowExitNotifier; 25 | 26 | @end 27 | 28 | static CSMLocationManager *_sharedInstance = nil; 29 | 30 | @implementation CSMLocationManager 31 | 32 | + (instancetype)sharedManager { 33 | static dispatch_once_t onceToken; 34 | dispatch_once(&onceToken, ^{ 35 | _sharedInstance = [[CSMLocationManager alloc] init]; 36 | }); 37 | return _sharedInstance; 38 | } 39 | 40 | 41 | #pragma mark - Peripheral Manager Helpers 42 | 43 | - (void)initializePeripheralManager { 44 | // initialize new peripheral manager and begin monitoring for updates 45 | if (!self.peripheralManager) { 46 | self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil]; 47 | 48 | // fire initial notification 49 | [self fireUpdateNotificationForStatus:@"Initializing CBPeripheralManager and waiting for state updates..."]; 50 | } 51 | } 52 | 53 | - (void)startAdvertisingBeacon { 54 | // initialize new CLBeaconRegion and start advertising target region 55 | if (![self.peripheralManager isAdvertising]) { 56 | self.peripheralData = [[CSMBeaconRegion targetRegion] peripheralDataWithMeasuredPower:nil]; 57 | [self.peripheralManager startAdvertising:self.peripheralData]; 58 | } 59 | } 60 | 61 | - (void)stopAdvertisingBeacon { 62 | // stop advertising CLBeaconRegion 63 | if ([self.peripheralManager isAdvertising]) { 64 | [self.peripheralManager stopAdvertising]; 65 | self.peripheralManager = nil; 66 | self.peripheralData = nil; 67 | } 68 | } 69 | 70 | - (void)startBeaconRanging { 71 | 72 | // set entrance notifier flag 73 | self.didShowEntranceNotifier = YES; 74 | 75 | // start beacon ranging 76 | [self.locationManager startRangingBeaconsInRegion:[CSMBeaconRegion targetRegion]]; 77 | 78 | // fire notification with region update 79 | [self fireUpdateNotificationForStatus:@"Welcome! You have entered the target region."]; 80 | } 81 | 82 | - (void)fireUpdateNotificationForStatus:(NSString*)status { 83 | // fire notification to update displayed status 84 | [[NSNotificationCenter defaultCenter] postNotificationName:kLocationUpdateNotification 85 | object:Nil 86 | userInfo:@{@"status" : status}]; 87 | } 88 | 89 | 90 | #pragma mark - CBPeripheralManagerDelegate 91 | 92 | - (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral { 93 | 94 | NSString *status; 95 | switch (peripheral.state) { 96 | case CBPeripheralManagerStateUnsupported: 97 | // ensure you are using a device supporting Bluetooth 4.0 or above. 98 | // not supported on iOS 7 simulator 99 | status = @"Device platform does not support BTLE peripheral role."; 100 | break; 101 | 102 | case CBPeripheralManagerStateUnauthorized: 103 | // verify app is permitted to use Bluetooth 104 | status = @"App is not authorized to use BTLE peripheral role."; 105 | break; 106 | 107 | case CBPeripheralManagerStatePoweredOff: 108 | // Bluetooth service is powered off 109 | status = @"Bluetooth service is currently powered off on this device."; 110 | break; 111 | 112 | case CBPeripheralManagerStatePoweredOn: 113 | // start advertising CLBeaconRegion 114 | status = @"Now advertising iBeacon signal. Monitor other device for location updates."; 115 | [self startAdvertisingBeacon]; 116 | break; 117 | 118 | case CBPeripheralManagerStateResetting: 119 | // Temporarily lost connection 120 | status = @"Bluetooth connection was lost. Waiting for update..."; 121 | break; 122 | 123 | case CBPeripheralManagerStateUnknown: 124 | default: 125 | // Connection status unknown 126 | status = @"Current peripheral state unknown. Waiting for update..."; 127 | break; 128 | } 129 | 130 | // fire notification with status update 131 | [self fireUpdateNotificationForStatus:status]; 132 | } 133 | 134 | 135 | #pragma mark - CLLocationManager Helpers 136 | 137 | - (void)initializeRegionMonitoring { 138 | 139 | // initialize new location manager 140 | if (!self.locationManager) { 141 | self.locationManager = [[CLLocationManager alloc] init]; 142 | self.locationManager.delegate = self; 143 | self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; 144 | } 145 | 146 | if ([CSMAppDelegate appDelegate].applicationMode == CSMApplicationModeRegionMonitoring) { 147 | 148 | // begin region monitoring 149 | [self.locationManager startMonitoringForRegion:[CSMBeaconRegion targetRegion]]; 150 | 151 | // fire notification with initial status 152 | [self fireUpdateNotificationForStatus:@"Initializing CLLocationManager and initiating region monitoring..."]; 153 | } 154 | } 155 | 156 | - (void)stopMonitoringForRegion:(CLBeaconRegion*)region { 157 | // stop monitoring for region 158 | [self.locationManager stopMonitoringForRegion:region]; 159 | 160 | self.locationManager = nil; 161 | 162 | // reset notifiers 163 | self.didShowEntranceNotifier = NO; 164 | self.didShowExitNotifier = NO; 165 | } 166 | 167 | 168 | #pragma mark - CLLocationManagerDelegate 169 | 170 | - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { 171 | 172 | // fire notification with failure status 173 | [self fireUpdateNotificationForStatus:[NSString stringWithFormat:@"Location manager failed with error: %@",error.localizedDescription]]; 174 | } 175 | 176 | - (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region { 177 | 178 | // handle notifyEntryStateOnDisplay 179 | // notify user they have entered the region, if you haven't already 180 | if (manager == self.locationManager && 181 | [region.identifier isEqualToString:kUniqueRegionIdentifier] && 182 | state == CLRegionStateInside && 183 | !self.didShowEntranceNotifier) { 184 | 185 | // start beacon ranging 186 | [self startBeaconRanging]; 187 | } 188 | } 189 | 190 | - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { 191 | 192 | // handle notifyOnEntry 193 | // notify user they have entered the region, if you haven't already 194 | if (manager == self.locationManager && 195 | [region.identifier isEqualToString:kUniqueRegionIdentifier] && 196 | !self.didShowEntranceNotifier) { 197 | 198 | // start beacon ranging 199 | [self startBeaconRanging]; 200 | } 201 | } 202 | 203 | - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { 204 | 205 | // optionally notify user they have left the region 206 | if (!self.didShowExitNotifier) { 207 | 208 | self.didShowExitNotifier = YES; 209 | 210 | // fire notification with region update 211 | [self fireUpdateNotificationForStatus:@"Thanks for visiting. You have now left the target region."]; 212 | } 213 | 214 | // reset entrance notifier 215 | self.didShowEntranceNotifier = NO; 216 | 217 | // stop beacon ranging 218 | [manager stopRangingBeaconsInRegion:[CSMBeaconRegion targetRegion]]; 219 | } 220 | 221 | - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region { 222 | 223 | // identify closest beacon in range 224 | if ([beacons count] > 0) { 225 | CLBeacon *closestBeacon = beacons[0]; 226 | if (closestBeacon.proximity == CLProximityImmediate) { 227 | /** 228 | Provide proximity based information to user. You may choose to do this repeatedly 229 | or only once depending on the use case. Optionally use major, minor values here to provide beacon-specific content 230 | */ 231 | [self fireUpdateNotificationForStatus:@"You are in the immediate vicinity of the Beacon."]; 232 | 233 | } else if (closestBeacon.proximity == CLProximityNear) { 234 | // detect other nearby beacons 235 | // optionally hide previously displayed proximity based information 236 | [self fireUpdateNotificationForStatus:@"There are Beacons nearby."]; 237 | } 238 | } else { 239 | // no beacons in range - signal may have been lost 240 | // optionally hide previously displayed proximity based information 241 | [self fireUpdateNotificationForStatus:@"There are currently no Beacons within range."]; 242 | } 243 | } 244 | 245 | - (void)locationManager:(CLLocationManager *)manager rangingBeaconsDidFailForRegion:(CLBeaconRegion *)region withError:(NSError *)error { 246 | 247 | // fire notification of range failure 248 | [self fireUpdateNotificationForStatus:[NSString stringWithFormat:@"Beacon ranging failed with error: %@", error]]; 249 | 250 | // assume notifications failed, reset indicators 251 | self.didShowEntranceNotifier = NO; 252 | self.didShowExitNotifier = NO; 253 | } 254 | 255 | - (void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region { 256 | 257 | // fire notification of region monitoring 258 | [self fireUpdateNotificationForStatus:[NSString stringWithFormat:@"Now monitoring for region: %@",((CLBeaconRegion*)region).identifier]]; 259 | } 260 | 261 | - (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error { 262 | 263 | // fire notification with status update 264 | [self fireUpdateNotificationForStatus:[NSString stringWithFormat:@"Region monitoring failed with error: %@", error]]; 265 | 266 | // assume notifications failed, reset indicators 267 | self.didShowEntranceNotifier = NO; 268 | self.didShowExitNotifier = NO; 269 | } 270 | 271 | - (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { 272 | 273 | // current location usage is required to use this demo app 274 | if (status == kCLAuthorizationStatusDenied || status == kCLAuthorizationStatusRestricted) { 275 | [[[UIAlertView alloc] initWithTitle:@"Current Location Required" 276 | message:@"Please re-enable Core Location to run this Demo. The app will now exit." 277 | delegate:self 278 | cancelButtonTitle:nil 279 | otherButtonTitles:@"OK", nil] show]; 280 | } 281 | } 282 | 283 | 284 | #pragma mark - UIAlertViewDelegate 285 | 286 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { 287 | // exit application if user declined Current Location permissions 288 | exit(0); 289 | } 290 | 291 | @end 292 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMLocationUpdateController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSMLocationUpdateController.h 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 10/7/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSMAppDelegate.h" 11 | 12 | @interface CSMLocationUpdateController : UIViewController 13 | 14 | - (id)initWithLocationMode:(CSMApplicationMode)appMode; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMLocationUpdateController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSMLocationUpdateController.m 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 10/7/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import "CSMLocationUpdateController.h" 10 | #import "CSMLocationManager.h" 11 | #import "CSMBeaconRegion.h" 12 | #import 13 | 14 | #define kDefaultPadding 25 15 | #define kVerticalPadding 15 16 | 17 | #define kLocationUpdateNotification @"updateNotification" 18 | 19 | #define kLabelText [CSMAppDelegate appDelegate].applicationMode == CSMApplicationModePeripheral ? @"iBeacon Status:" : @"Region Monitoring Status:"; 20 | 21 | @interface CSMLocationUpdateController () 22 | 23 | @property (nonatomic, strong) UILabel *titleLabel; 24 | @property (nonatomic, strong) UITextView *statusView; 25 | 26 | @end 27 | 28 | @implementation CSMLocationUpdateController 29 | 30 | - (id)initWithLocationMode:(CSMApplicationMode)appMode { 31 | 32 | self = [super init]; 33 | if (self) { 34 | [CSMAppDelegate appDelegate].applicationMode = appMode; 35 | 36 | self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 37 | 38 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" 39 | style:UIBarButtonSystemItemCancel 40 | target:self 41 | action:@selector(cancelTapped:)]; 42 | } 43 | return self; 44 | } 45 | 46 | 47 | #pragma mark - View LifeCycle 48 | 49 | - (void)viewDidLoad { 50 | [super viewDidLoad]; 51 | 52 | self.view.backgroundColor = [UIColor whiteColor]; 53 | 54 | self.titleLabel = [UILabel new]; 55 | self.titleLabel.textAlignment = NSTextAlignmentCenter; 56 | self.titleLabel.preferredMaxLayoutWidth = self.view.bounds.size.width - 2*kDefaultPadding; 57 | self.titleLabel.text = kLabelText; 58 | self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; 59 | [self.view addSubview:self.titleLabel]; 60 | 61 | self.statusView = [UITextView new]; 62 | self.statusView.textAlignment = NSTextAlignmentCenter; 63 | self.statusView.font = [UIFont systemFontOfSize:14.0]; 64 | self.statusView.textColor = [UIColor darkGrayColor]; 65 | self.statusView.userInteractionEnabled = NO; 66 | [self.statusView setTextContainerInset:UIEdgeInsetsMake(30, kDefaultPadding, kDefaultPadding, kDefaultPadding)]; 67 | self.statusView.layer.borderColor = kAppTintColor.CGColor; 68 | self.statusView.layer.borderWidth = 1; 69 | self.statusView.translatesAutoresizingMaskIntoConstraints = NO; 70 | [self.view addSubview:self.statusView]; 71 | 72 | // define auto layout constraints 73 | NSDictionary *constraintMetrics = @{@"horizontalPadding" : @kDefaultPadding, 74 | @"topPadding" : @(2*kDefaultPadding), 75 | @"verticalPadding" : @kVerticalPadding}; 76 | NSDictionary *constraintViews = @{@"label" : self.titleLabel, 77 | @"status" : self.statusView, 78 | @"topGuide" : self.topLayoutGuide}; 79 | 80 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-horizontalPadding-[label]-horizontalPadding-|" 81 | options:0 82 | metrics:constraintMetrics 83 | views:constraintViews]]; 84 | 85 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-horizontalPadding-[status(>=200)]-horizontalPadding-|" 86 | options:0 87 | metrics:constraintMetrics 88 | views:constraintViews]]; 89 | 90 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[topGuide]-topPadding-[label]-verticalPadding-[status]-(<=180)-|" 91 | options:0 92 | metrics:constraintMetrics 93 | views:constraintViews]]; 94 | } 95 | 96 | - (void)viewDidAppear:(BOOL)animated { 97 | [super viewDidAppear:animated]; 98 | 99 | // add observer for location notifications 100 | [[NSNotificationCenter defaultCenter] addObserver:self 101 | selector:@selector(handleStatusUpdate:) 102 | name:kLocationUpdateNotification 103 | object:nil]; 104 | 105 | if ([CSMAppDelegate appDelegate].applicationMode == CSMApplicationModePeripheral) { 106 | 107 | // initiate peripheral (iBeacon) broadcasting mode 108 | [self enablePeripheralMode]; 109 | 110 | } else { 111 | 112 | // initate region monitoring monitoring mode 113 | [self enableRegionMonitoringMode]; 114 | } 115 | } 116 | 117 | - (void)viewDidDisappear:(BOOL)animated { 118 | [super viewDidDisappear:animated]; 119 | 120 | if ([CSMAppDelegate appDelegate].applicationMode == CSMApplicationModePeripheral) { 121 | 122 | // stop advertising Beacon 123 | [[CSMLocationManager sharedManager] stopAdvertisingBeacon]; 124 | 125 | } else { 126 | 127 | // stop region monitoring 128 | [[CSMLocationManager sharedManager] stopMonitoringForRegion:[CSMBeaconRegion targetRegion]]; 129 | } 130 | 131 | // remove notifications observer 132 | [[NSNotificationCenter defaultCenter] removeObserver:self name:kLocationUpdateNotification object:nil]; 133 | } 134 | 135 | 136 | #pragma mark - Helpers 137 | 138 | - (void)enableRegionMonitoringMode { 139 | 140 | [[CSMLocationManager sharedManager] initializeRegionMonitoring]; 141 | 142 | self.title = @"Monitoring iBeacons"; 143 | } 144 | 145 | - (void)enablePeripheralMode { 146 | 147 | [[CSMLocationManager sharedManager] initializePeripheralManager]; 148 | 149 | self.title = @"Broadcasting iBeacon"; 150 | } 151 | 152 | 153 | #pragma mark - UIResponse 154 | 155 | - (void)cancelTapped:(id)sender { 156 | [self dismissViewControllerAnimated:YES completion:NULL]; 157 | } 158 | 159 | 160 | #pragma mark - Notifications 161 | 162 | - (void)handleStatusUpdate:(NSNotification*)notification { 163 | 164 | // update status message displayed 165 | self.statusView.text = notification.userInfo[@"status"]; 166 | 167 | // log message for debugging 168 | NSLog(@"%@", notification.userInfo[@"status"]); 169 | } 170 | 171 | @end 172 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMRootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSMRootViewController.h 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CSMRootViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /iBeaconDemo/CSMRootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSMRootViewController.m 3 | // iBeacons_Demo 4 | // 5 | // Created by Christopher Mann on 9/5/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import "CSMRootViewController.h" 10 | #import "CSMHomeViewController.h" 11 | 12 | @interface CSMRootViewController () 13 | 14 | @property (nonatomic, strong) CSMHomeViewController *homeController; 15 | @property (nonatomic, strong) UINavigationController *navController; 16 | 17 | @end 18 | 19 | @implementation CSMRootViewController 20 | 21 | - (id)init { 22 | self = [super init]; 23 | if (self) { 24 | 25 | } 26 | return self; 27 | } 28 | 29 | - (void)loadView { 30 | self.view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; 31 | self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 32 | 33 | // add home controller 34 | self.homeController = [[CSMHomeViewController alloc] init]; 35 | self.navController = [[UINavigationController alloc] initWithRootViewController:self.homeController]; 36 | 37 | [self addChildViewController:self.navController]; 38 | self.navController.view.frame = self.view.frame; 39 | [self.view addSubview:self.navController.view]; 40 | [self.navController didMoveToParentViewController:self]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /iBeaconDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "size" : "60x60", 15 | "idiom" : "iphone", 16 | "filename" : "Icon_120.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "idiom" : "ipad", 21 | "size" : "29x29", 22 | "scale" : "1x" 23 | }, 24 | { 25 | "idiom" : "ipad", 26 | "size" : "29x29", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "idiom" : "ipad", 31 | "size" : "40x40", 32 | "scale" : "1x" 33 | }, 34 | { 35 | "idiom" : "ipad", 36 | "size" : "40x40", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "76x76", 41 | "idiom" : "ipad", 42 | "filename" : "Icon_76.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "76x76", 47 | "idiom" : "ipad", 48 | "filename" : "Icon_152.png", 49 | "scale" : "2x" 50 | } 51 | ], 52 | "info" : { 53 | "version" : 1, 54 | "author" : "xcode" 55 | } 56 | } -------------------------------------------------------------------------------- /iBeaconDemo/Images.xcassets/AppIcon.appiconset/Icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csmann/iBeaconDemo/bd5280ea8b91a4633e03fb68b72fca1c32645b2b/iBeaconDemo/Images.xcassets/AppIcon.appiconset/Icon_120.png -------------------------------------------------------------------------------- /iBeaconDemo/Images.xcassets/AppIcon.appiconset/Icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csmann/iBeaconDemo/bd5280ea8b91a4633e03fb68b72fca1c32645b2b/iBeaconDemo/Images.xcassets/AppIcon.appiconset/Icon_152.png -------------------------------------------------------------------------------- /iBeaconDemo/Images.xcassets/AppIcon.appiconset/Icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csmann/iBeaconDemo/bd5280ea8b91a4633e03fb68b72fca1c32645b2b/iBeaconDemo/Images.xcassets/AppIcon.appiconset/Icon_76.png -------------------------------------------------------------------------------- /iBeaconDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /iBeaconDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /iBeaconDemo/iBeaconDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.captechventures.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSLocationUsageDescription 28 | Current location is used to monitor proximity to iBeacons. 29 | UIBackgroundModes 30 | 31 | location 32 | bluetooth-peripheral 33 | 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /iBeaconDemo/iBeaconDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /iBeaconDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iBeaconDemo 4 | // 5 | // Created by Christopher Mann on 10/9/13. 6 | // Copyright (c) 2013 Christopher Mann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CSMAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CSMAppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------