IOS7 App Development Essentials(2)iBeacon
1. Beacon Introduction
CLBeacon
RSSI(Received Signal Strength Indication) [-93, -113]
accuracy The accuracy of the proximity value, measured in meters from the beacon
proximity The relative distance to the beacon.
2. Building Steps
General ——> Linked Frameworks and Libraries
I should add these features before I begin.
CoreLocation.framework
CoreBluetooth.framework
Here is the interface in project EasyUIApp.
#import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> #import <CoreBluetooth/CoreBluetooth.h>@interface EABeaconsViewController : UIViewController <CLLocationManagerDelegate, CBPeripheralManagerDelegate, UITableViewDataSource, UITableViewDelegate]]> @property (nonatomic,weak) IBOutletUISwitch *advertisingSwitch; @property (nonatomic,weak) IBOutletUISwitch *monitorSwitch; @property (nonatomic,weak) IBOutletUISwitch *rangingSwitch; @property (nonatomic,weak) IBOutletUITableView *beaconTableView; @end
The import Implementation are as follow:
- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region {
//enter region - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{ } //exit region - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region{ }
//ranging beacon - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region {
Tips
1. Update the iOS Version
Check your phone model
http://support.apple.com/kb/ht3939
My phone model is A1428 at the back cover, it is GSM model.
Download the beta version
https://developer.apple.com/devcenter/ios/index.action#betadownloads
Both for Xcode and iOS
ios_7.1_beta_5__iphone_5_model_a1428__11d5145e.dmg
xcode_5.1_beta5.dmg
Press ‘Option’ and click on the ‘Restore IPhone'
2. Downgrade the iOS 7.1 beta to iOS 7.0.x
First of all, prepare and download the latest 7.0.x version from developer center.
iPhone5,1_7.0.6_11B651_Restore.ipsw
Hold the “Home” button and the “Power” button for 10 seconds, then release the “Power” button. The iTunes will show you that the iPhone is under Recovery Mode.
Hold the ‘alt’ ‘option’ button on my MAC book. Click on the ‘Restore IPhone’ on the iTunes. Select my lovely ipsw file.
3. Detect the App Foreground and Background
+ (void)load { [[NSNotificationCenterdefaultCenter] addObserver:self selector:@selector(handleAppLaunched) name:UIApplicationDidFinishLaunchingNotificationobject:nil]; [[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(handleAppResigningActive) name:UIApplicationWillResignActiveNotificationobject:nil]; [[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(handleAppBecomingActive) name:UIApplicationDidBecomeActiveNotificationobject:nil]; [[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(handleAppEnteringBackground) name:UIApplicationDidEnterBackgroundNotificationobject:nil]; [[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(handleAppEnteringForeground) name:UIApplicationWillEnterForegroundNotificationobject:nil]; [[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(handleAppClosing) name:UIApplicationWillTerminateNotificationobject:nil]; } + (void)handleAppLaunched{ NSLog(@"I am handleAppLaunched....."); } + (void)handleAppResigningActive{ NSLog(@"I am handleAppResigningActive....."); } + (void)handleAppBecomingActive{ NSLog(@"I am handleAppBecomingActive....."); } + (void)handleAppEnteringBackground{ NSLog(@"I am handleAppEnteringBackground....."); } + (void)handleAppEnteringForeground{ NSLog(@"I am handleAppEnteringForeground....."); } + (void)handleAppClosing{ NSLog(@"I am handleAppClosing....."); }
Or I can change all the method from + class method to - instance method, and call the method in my startMethod or -(void)viewDidLoad.
References:
http://code-evolution.blogspot.com/2011/02/evolved-code-2-splendid-approach-for.html
- 浏览: 2486659 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
发表评论
-
ionic UI(4)ionic2 framework - basic and components and native
2016-03-24 02:33 1222ionic UI(4)ionic2 framework - b ... -
ionic UI(3)TypeScript - handbook
2016-03-22 23:21 590ionic UI(3)TypeScript - handboo ... -
ionic UI(2)ionic2 framework - TypeScript - tutorial
2016-03-22 06:52 1619ionic UI(2)ionic2 framework - T ... -
Parse and Heroku Service(3)Parse Server and Parse Dashboard
2016-03-22 06:30 941Parse and Heroku Service(3)Pars ... -
Parse and Heroku Service(2)Mail Templates and Push Notification
2016-03-22 02:45 542Parse and Heroku Service(2)Mail ... -
ionic UI(1)Introduction
2016-03-19 03:18 679ionic UI(1)Introduction 1 Inst ... -
Parse and Heroku Service(1)Heroku Installation and Play
2016-03-19 00:13 784Parse and Heroic Service(1)Hero ... -
Hybrid(5)Customize Meteor Directly Google Login
2015-09-01 02:33 885Hybrid(5)Customize Meteor Direc ... -
Hybrid(4)Favorite Places - Google Login
2015-09-01 02:02 1296Hybrid(4)Favorite Places - Goog ... -
Hybrid(3)More Meteor Example - Social
2015-08-11 05:04 727Hybrid(3)More Meteor Example - ... -
Hybrid(2)meteor Running Android and iOS
2015-07-28 23:59 1003Hybrid(2)meteor Running Android ... -
Create the Google Play Account
2015-07-18 06:42 1055Create the Google Play Account ... -
Secure REST API and Mobile(1)Document Read and Understand OAUTH2
2015-07-14 00:36 728Secure REST API and Mobile(1)Do ... -
Screen Size and Web Design
2015-07-11 01:11 694Screen Size and Web Design iPh ... -
Hybrid(1)ionic Cordova meteor
2015-06-25 05:49 429Hybrid(1)ionic Cordova meteor ... -
Android Fire Project(1)Recall Env and Knowledge
2015-02-11 12:28 649Android Fire Project(1)Recall ... -
Android Content Framework(1)Concept
2014-06-14 13:54 1049Android Content Framework(1)Con ... -
Feel Android Studio(1)Install and Update Android Studio
2014-04-11 03:12 1974Feel Android Studio(1)Install a ... -
IOS7 App Development Essentials(1) Persistent Store
2014-03-05 05:54 1277IOS7 App Development Essentials ... -
Mobile Jquery(5)Update and Know about Express
2014-01-30 06:33 1227Mobile Jquery(5)Update and Know ...
相关推荐
iOS 10 App Development Essentials: Learn to Develop iOS 10 Apps with Xcode 8 and Swift 3 Author: Neil Smyth Length: 816 pages Edition: 1 Language: English Publisher: CreateSpace Independent Publishing...
iOS 11 App Development Essentials Learn to Develop iOS 11 Apps with Xcode 9 and Swift 4 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
iOS 11 App Development Essentials Learn to Develop iOS 11 Apps with Xcode 9 and Swift 4
iOS 8 应用开发基础 源码2 using Xcode 6.3 (Swift 1.2): iOS 8 App Development Essentials Source Code
iOS 11 App Development Essentials Learn to Develop iOS 11 Apps with Xcode 9 and Swift 4 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
iOS 7 App Development Essentials 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系...
iOS 11 App Development Essentials – First Edition 2018
iOS 10 App Development Essentials 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
iOS 9 App Development Essentials 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系...
非常不错的一本学习iOS开发的基础书籍,最主要它是For iOS7和Xcode5的。
iOS 11 App Development Essentials Learn to Develop iOS 11 Apps with Xcode 9 and Swift 4 英文无水印转化版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源...
本书概述了iPhone硬件和iOS 4的体系结构。提供了Objective-C编程的简介,然后深入研究了iPhone应用程序和用户界面的设计。
介绍如何使用Xcode和Swift构建适用于iOS 8的应用程序。
Title: iOS 8 App Development Essentials Author: Neil Smyth Length: 824 pages Edition: 1 Language: English Publisher: CreateSpace Independent Publishing Platform Publication Date: 2014-12-16 ISBN-10: ...
本书旨在教授使用 iOS 16 SDK、UIKit、Xcode 14 和 Swift 编程语言创建 iOS 应用程序所需的技能。 本书从基础开始,概述了设置 iOS 开发环境所需的步骤。接下来,介绍了 iOS 16 的架构和 Swift 5.7 中的编程,然后...
提供开始构建iPad应用所需的知识。
iOS 9 App Development Essentials is latest edition of this popular book series and has now been fully updated for the iOS 9 SDK, Xcode 7 and the Swift 2 programming language. Beginning with the ...
最新的iOS开发技术 iOS 7 App Development Essentials – First Edition ISBN-13: 978-0-9860273-5-2
IOS 11 swift programming cookbook