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
- 浏览: 2543083 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
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 1256ionic UI(4)ionic2 framework - b ... -
ionic UI(3)TypeScript - handbook
2016-03-22 23:21 630ionic UI(3)TypeScript - handboo ... -
ionic UI(2)ionic2 framework - TypeScript - tutorial
2016-03-22 06:52 1649ionic UI(2)ionic2 framework - T ... -
Parse and Heroku Service(3)Parse Server and Parse Dashboard
2016-03-22 06:30 961Parse and Heroku Service(3)Pars ... -
Parse and Heroku Service(2)Mail Templates and Push Notification
2016-03-22 02:45 575Parse and Heroku Service(2)Mail ... -
ionic UI(1)Introduction
2016-03-19 03:18 715ionic UI(1)Introduction 1 Inst ... -
Parse and Heroku Service(1)Heroku Installation and Play
2016-03-19 00:13 816Parse and Heroic Service(1)Hero ... -
Hybrid(5)Customize Meteor Directly Google Login
2015-09-01 02:33 908Hybrid(5)Customize Meteor Direc ... -
Hybrid(4)Favorite Places - Google Login
2015-09-01 02:02 1333Hybrid(4)Favorite Places - Goog ... -
Hybrid(3)More Meteor Example - Social
2015-08-11 05:04 750Hybrid(3)More Meteor Example - ... -
Hybrid(2)meteor Running Android and iOS
2015-07-28 23:59 1043Hybrid(2)meteor Running Android ... -
Create the Google Play Account
2015-07-18 06:42 1096Create the Google Play Account ... -
Secure REST API and Mobile(1)Document Read and Understand OAUTH2
2015-07-14 00:36 757Secure REST API and Mobile(1)Do ... -
Screen Size and Web Design
2015-07-11 01:11 719Screen Size and Web Design iPh ... -
Hybrid(1)ionic Cordova meteor
2015-06-25 05:49 462Hybrid(1)ionic Cordova meteor ... -
Android Fire Project(1)Recall Env and Knowledge
2015-02-11 12:28 678Android Fire Project(1)Recall ... -
Android Content Framework(1)Concept
2014-06-14 13:54 1072Android Content Framework(1)Con ... -
Feel Android Studio(1)Install and Update Android Studio
2014-04-11 03:12 2022Feel Android Studio(1)Install a ... -
IOS7 App Development Essentials(1) Persistent Store
2014-03-05 05:54 1318IOS7 App Development Essentials ... -
Mobile Jquery(5)Update and Know about Express
2014-01-30 06:33 1256Mobile 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应用程序开发基础:使用Xcode 9学习开发iOS 11应用程序 本书籍主要向读者介绍了如何使用Xcode 9和Swift 4来开发iOS 11应用程序。以下是从书籍的描述、标签和提供的部分内容中提炼出的知识点: 1. Xcode 9与...
iOS 11 App Development Essentials Learn to Develop iOS 11 Apps with Xcode 9 and Swift 4 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
《iOS 8应用开发基础》源码解析 本资源包含了使用Xcode 6.3(Swift 1.2)编写的iOS 8应用程序开发的基础源码。这些源代码旨在帮助开发者深入理解iOS 8应用开发的基本概念和技术,通过实际操作来学习Swift语言以及...
iOS 10 App Development Essentials 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
2. 安装和配置Xcode 5及iOS 7 SDK。 3. 创建基础iOS 7应用的步骤和遇到常见问题的处理方法。 4. 测试和适配应用在不同设备和iOS版本上的显示效果。 5. 监控应用性能,确保良好的用户体验。 6. 理解iOS 7的系统架构...
iOS 9 App Development Essentials 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系...
本书《iOS 11 App Development Essentials》旨在帮助读者掌握开发 iOS 11 应用所需的基本技能。它覆盖了从安装开发环境到构建应用的全过程,并深入介绍了 Swift 4 编程语言的基础知识。对于新接触 iOS 开发的人来说...
《iOS 11应用开发精华》是Neil Smyth所著的一本书,旨在指导开发者如何使用Swift语言和Xcode开发工具来开发适用于iOS 11的iPhone应用。本书涵盖了从基础概念到高级特性的广泛内容,适合初学者和已有一些iOS开发经验...
本书概述了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 4 App开发要点-Xcode 4版 #### 引言 随着移动设备的普及,特别是苹果公司的iPad发布后,iOS平台的应用程序开发变得越来越重要。本篇内容将聚焦于iPad上运行的iOS 4应用程序开发的核心知识点,特别强调...
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 8 SDK Development is a practical guide to the essentials of developing for iOS 8. You'll start building and revising a real app that's written entirely in Apple's new Swift programming language. ...
WatchKit应用程序和WatchKit应用程序开发的简介。 本书面向具有使用Xcode和Swift编程语言进行iOS开发的一些现有经验的读者。