├── CCLocationDemo
├── CCLocationDemo
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── icon.png
│ │ │ ├── Icon-76.png
│ │ │ ├── Icon-60@2x.png
│ │ │ ├── Icon-60@3x.png
│ │ │ ├── Icon-76@2x.png
│ │ │ ├── Icon-Small.png
│ │ │ ├── Icon-83.5@2x.png
│ │ │ ├── Icon-Small-40.png
│ │ │ ├── Icon-Small@2x.png
│ │ │ ├── Icon-Small@3x.png
│ │ │ ├── Icon-Small@2x-1.png
│ │ │ ├── Icon-Notification.png
│ │ │ ├── Icon-Small-40@2x-1.png
│ │ │ ├── Icon-Small-40@2x.png
│ │ │ ├── Icon-Small-40@3x.png
│ │ │ ├── Icon-Notification@2x.png
│ │ │ ├── Icon-Notification@3x.png
│ │ │ ├── Icon-Notification@2x-1.png
│ │ │ └── Contents.json
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
│ ├── Info.plist
│ ├── AppDelegate.m
│ └── ViewController.m
└── CCLocationDemo.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── Rachal.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── xcuserdata
│ └── Rachal.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── project.pbxproj
├── CCLocationFetcher
├── NSObject+Model.h
├── NSObject+Model.m
├── CCLocationFetcher.h
└── CCLocationFetcher.m
├── CCLocationFetcher.podspec
├── LICENSE
└── README.md
/CCLocationDemo/CCLocationDemo/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/icon.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x-1.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x-1.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification@3x.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Icon-Notification@2x-1.png
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo.xcodeproj/project.xcworkspace/xcuserdata/Rachal.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RachalZhou/CCLocationFetcher/HEAD/CCLocationDemo/CCLocationDemo.xcodeproj/project.xcworkspace/xcuserdata/Rachal.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // CCLocationDemo
4 | //
5 | // Created by Rachal Zhou.
6 | // Copyright © 2018年 RachalPersonal. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CCLocationFetcher/NSObject+Model.h:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 字典、数组转模型
4 | */
5 | #import
6 |
7 | @interface NSObject (Model)
8 |
9 | /**
10 | * 字典转模型,返回模型对象
11 | */
12 | + (instancetype)modelWithDictionary:(NSDictionary *)dic;
13 |
14 | /**
15 | * 数组转模型,返回模型数组
16 | */
17 | + (NSArray *)modelWithArray:(NSArray *)array;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // CCLocationDemo
4 | //
5 | // Created by Rachal Zhou.
6 | // Copyright © 2018年 RachalPersonal. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // CCLocationDemo
4 | //
5 | // Created by Rachal Zhou.
6 | // Copyright © 2018年 RachalPersonal. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo.xcodeproj/xcuserdata/Rachal.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | CCLocationDemo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/CCLocationFetcher/NSObject+Model.m:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 字典、数组转模型(KVC)
4 | */
5 | #import "NSObject+Model.h"
6 |
7 | @implementation NSObject (Model)
8 |
9 | + (instancetype)modelWithDictionary:(NSDictionary *)dic {
10 |
11 | id obj = [[[self class] alloc] init];
12 | [obj setValuesForKeysWithDictionary:dic];
13 | return obj;
14 | }
15 |
16 | + (NSArray *)modelWithArray:(NSArray *)array {
17 |
18 | NSMutableArray *objs = [NSMutableArray array];
19 | for (NSDictionary *dic in array) {
20 |
21 | id obj = [[self class] modelWithDictionary:dic];
22 | [objs addObject:obj];
23 | }
24 | return objs;
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/CCLocationFetcher.podspec:
--------------------------------------------------------------------------------
1 |
2 | Pod::Spec.new do |s|
3 | s.name = "CCLocationFetcher"
4 | s.version = "0.0.3"
5 | s.summary = "A tool that get location info easily."
6 | s.description = "You can use CCLocationFetcher to get location info with one line of code."
7 | s.homepage = "https://github.com/RachalZhou/CCLocationFetcher"
8 | s.license = { :type => "MIT", :file => "LICENSE" }
9 | s.author = { "RachalZhou" => "1048255049@qq.com" }
10 | s.platform = :ios, "8.0"
11 | s.source = { :git => "https://github.com/RachalZhou/CCLocationFetcher.git", :tag => "v#{s.version}" }
12 | s.source_files = "CCLocationFetcher"
13 | s.requires_arc = true
14 | end
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 RachalZhou
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CCLocationFetcher
2 | Customized location manager for Objective-C
3 |
4 | ### 说明
5 | 对CoreLocation的封装。
6 |
7 | 将定位相关的代码从 **Controller** 中分离,封装到 **NSObject** 对象中。采用 **block** 回调的方式降低代码的分散度,方便调用亦易于获取位置信息。
8 |
9 | ### 使用方法
10 | 支持**cocoapods**,或直接将**CCLocationFetcher**文件夹拖入工程,引用。
11 |
12 | **CCLocationFetcher** 对象调 ***startWithCompletionHandler:*** 方法,返回一个存储定位信息的 **LocationModel** 对象,所需信息直接用点语法获取。以名为location对象为例,包含:
13 | * **location.longitude** 经度
14 | * **location.latitude** 纬度
15 | * **location.province** 省/直辖市
16 | * **location.city** 市
17 | * **location.subCity** 区/县
18 | * **location.street** 街道/路
19 | * **location.address** 详细地址(从省开始到街道)
20 |
21 | #### 方法一(推荐)
22 | 用单例初始化对象并调用 ***startWithCompletionHandler:*** 方法即可。随用随调。
23 | ```
24 | [[CCLocationFetcher sharedInstance] startWithCompletionHandler:^(LocationModel *location) {
25 |
26 | NSLog(@"经度:%@--纬度:%@--地址:%@",location.longitude,location.latitude,location.address);
27 | }];
28 | ```
29 |
30 | #### 方法二
31 | 传统初始化一个对象,调 ***startWithCompletionHandler:*** 方法。对象必须是实例变量。
32 | ```
33 | _fetcher = [[CCLocationFetcher alloc] init];
34 | [_fetcher startWithCompletionHandler:^(LocationModel *location) {
35 |
36 | NSLog(@"经度:%@--纬度:%@--地址:%@",location.longitude,location.latitude,location.address);
37 | }];
38 | ```
39 |
40 | ### 注意
41 | * 定位前确保网络和定位权限已设置
42 | * 方法一暂无局限性,随用随调,推荐
43 | * 方法二需将对象设置为实例变量,存在局限性
44 |
45 |
--------------------------------------------------------------------------------
/CCLocationFetcher/CCLocationFetcher.h:
--------------------------------------------------------------------------------
1 | //
2 | // CCLocationFetcher.h
3 | // Created by Rachal Zhou.
4 | // Copyright © 2018年 RachalPersonal. All rights reserved.
5 | //
6 |
7 | /* 方法一(推荐):
8 | * 直接用单例初始化对象并调用star方法即可,随用随调。
9 | * [[CCLocationFetcher sharedInstance] startWithCompletionHandler:];
10 | * 返回LocationModel对象,所需信息可直接用点语法调用,如:location.city、location.address
11 | */
12 |
13 | /* 方法二:
14 | * 传统init一个对象,然后调startWithCompletionHandler:方法,对象必须设置成属性或全局变量。
15 | * _fetcher = [[CCLocationFetcher alloc] init];
16 | * [_fetcher startWithCompletionHandler:];
17 | * 返回LocationModel对象,所需信息可直接用点语法调用,如:location.city、location.address
18 | */
19 |
20 | #import
21 |
22 | @class LocationModel;
23 |
24 | typedef void(^LocationFetcherCompletionHandler)(LocationModel *location);
25 |
26 | @interface CCLocationFetcher : NSObject
27 |
28 | + (instancetype)sharedInstance;
29 |
30 | - (void)startWithCompletionHandler:(LocationFetcherCompletionHandler)completion;
31 |
32 | @end
33 |
34 |
35 |
36 | #pragma mark - 位置数据模型
37 | @interface LocationModel : NSObject
38 |
39 | @property (nonatomic, copy) NSString *longitude;
40 | @property (nonatomic, copy) NSString *latitude;
41 | @property (nonatomic, copy) NSString *province;
42 | @property (nonatomic, copy) NSString *city;
43 | @property (nonatomic, copy) NSString *subCity;
44 | @property (nonatomic, copy) NSString *street;
45 | @property (nonatomic, copy) NSString *address;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Location
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | NSLocationAlwaysAndWhenInUseUsageDescription
26 | 需要您的地理位置获取周边信息
27 | NSLocationAlwaysUsageDescription
28 | 需要您的地理位置获取周边信息
29 | NSLocationWhenInUseUsageDescription
30 | 需要您的地理位置获取周边信息
31 | UILaunchStoryboardName
32 | LaunchScreen
33 | UIMainStoryboardFile
34 | Main
35 | UIRequiredDeviceCapabilities
36 |
37 | armv7
38 |
39 | UISupportedInterfaceOrientations
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 | UISupportedInterfaceOrientations~ipad
46 |
47 | UIInterfaceOrientationPortrait
48 | UIInterfaceOrientationPortraitUpsideDown
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // CCLocationDemo
4 | //
5 | // Created by Rachal Zhou.
6 | // Copyright © 2018年 RachalPersonal. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-Notification@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-Notification@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-Small@2x.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-Small@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-Small-40@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-Small-40@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-60@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-60@3x.png",
49 | "scale" : "3x"
50 | },
51 | {
52 | "size" : "20x20",
53 | "idiom" : "ipad",
54 | "filename" : "Icon-Notification.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-Notification@2x-1.png",
61 | "scale" : "2x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-Small.png",
67 | "scale" : "1x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-Small@2x-1.png",
73 | "scale" : "2x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-Small-40.png",
79 | "scale" : "1x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-Small-40@2x-1.png",
85 | "scale" : "2x"
86 | },
87 | {
88 | "size" : "76x76",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-76.png",
91 | "scale" : "1x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-76@2x.png",
97 | "scale" : "2x"
98 | },
99 | {
100 | "size" : "83.5x83.5",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-83.5@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "1024x1024",
107 | "idiom" : "ios-marketing",
108 | "filename" : "icon.png",
109 | "scale" : "1x"
110 | }
111 | ],
112 | "info" : {
113 | "version" : 1,
114 | "author" : "xcode"
115 | }
116 | }
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // CCLocationDemo
4 | //
5 | // Created by Rachal Zhou.
6 | // Copyright © 2018年 RachalPersonal. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "CCLocationFetcher.h"
11 |
12 | #define kScreenW CGRectGetWidth([UIScreen mainScreen].bounds)
13 | #define kScreenH CGRectGetHeight([UIScreen mainScreen].bounds)
14 |
15 | @interface ViewController ()
16 |
17 | @property (nonatomic, readwrite, strong) UILabel *label1;
18 | @property (nonatomic, readwrite, strong) UILabel *label2;
19 |
20 | @property (nonatomic, readwrite, strong) CCLocationFetcher *fetcher2;
21 |
22 | @end
23 |
24 | @implementation ViewController
25 |
26 | - (void)viewDidLoad {
27 | [super viewDidLoad];
28 |
29 | self.view.backgroundColor = [UIColor whiteColor];
30 |
31 | //测试Label和Button
32 | _label1 = [[UILabel alloc] init];
33 | _label1.bounds = CGRectMake(0, 0, kScreenW - 30, 30);
34 | _label1.center = CGPointMake(kScreenW / 2, 100);
35 | _label1.textAlignment = NSTextAlignmentCenter;
36 | _label1.backgroundColor = [UIColor greenColor];
37 | [self.view addSubview:_label1];
38 |
39 | UIButton *btn1 = [[UIButton alloc] init];
40 | btn1.bounds = CGRectMake(0, 0, 150, 30);
41 | btn1.center = CGPointMake(kScreenW / 2, 140);
42 | btn1.backgroundColor = [UIColor redColor];
43 | [btn1 setTitle:@"定位按钮1" forState:UIControlStateNormal];
44 | [btn1 addTarget:self action:@selector(click1) forControlEvents:UIControlEventTouchUpInside];
45 | [self.view addSubview:btn1];
46 |
47 | _label2 = [[UILabel alloc] init];
48 | _label2.bounds = CGRectMake(0, 0, kScreenW - 30, 30);
49 | _label2.center = CGPointMake(kScreenW / 2, 180);
50 | _label2.textAlignment = NSTextAlignmentCenter;
51 | _label2.backgroundColor = [UIColor yellowColor];
52 | [self.view addSubview:_label2];
53 |
54 | UIButton *btn2 = [[UIButton alloc] init];
55 | btn2.bounds = CGRectMake(0, 0, 150, 30);
56 | btn2.center = CGPointMake(kScreenW / 2, 220);
57 | btn2.backgroundColor = [UIColor redColor];
58 | [btn2 setTitle:@"定位按钮2" forState:UIControlStateNormal];
59 | [btn2 addTarget:self action:@selector(click2) forControlEvents:UIControlEventTouchUpInside];
60 | [self.view addSubview:btn2];
61 | }
62 |
63 | - (void)click1 {
64 |
65 | __weak typeof(self) weakSelf = self;
66 |
67 | //使用方法一(推荐)
68 | [[CCLocationFetcher sharedInstance] startWithCompletionHandler:^(LocationModel *location) {
69 |
70 | NSLog(@"经度:%@--纬度:%@--地址:%@",location.longitude,location.latitude,location.address);
71 | weakSelf.label1.text = location.address;
72 | }];
73 | }
74 |
75 | - (void)click2 {
76 |
77 | __weak typeof(self) weakSelf = self;
78 |
79 | //使用方法二
80 | _fetcher2 = [[CCLocationFetcher alloc] init];
81 | [_fetcher2 startWithCompletionHandler:^(LocationModel *location) {
82 |
83 | NSLog(@"经度:%@--纬度:%@--地址:%@",location.longitude,location.latitude,location.address);
84 | weakSelf.label2.text = [NSString stringWithFormat:@"经度:%@ 纬度:%@",location.longitude,location.latitude];
85 | }];
86 | }
87 |
88 | @end
89 |
--------------------------------------------------------------------------------
/CCLocationFetcher/CCLocationFetcher.m:
--------------------------------------------------------------------------------
1 | //
2 | // CCLocationFetcher.m
3 | // Created by Rachal Zhou.
4 | // Copyright © 2018年 RachalPersonal. All rights reserved.
5 | //
6 |
7 | #import "CCLocationFetcher.h"
8 | #import
9 | #import "NSObject+Model.h"
10 |
11 | @interface CCLocationFetcher()
12 |
13 | @property (nonatomic, strong) CLLocationManager *locationManager;
14 | @property (nonatomic, copy) LocationFetcherCompletionHandler completionHandler;
15 |
16 | @end
17 |
18 | @implementation CCLocationFetcher {
19 | NSUInteger _locationAge;//定位次数(避免重复定位)
20 | }
21 |
22 | //单例
23 | + (instancetype)sharedInstance {
24 | static CCLocationFetcher *sharedInstance = nil;
25 | static dispatch_once_t onceToken;
26 | dispatch_once(&onceToken, ^{
27 | sharedInstance = [[CCLocationFetcher alloc] init];
28 | });
29 | return sharedInstance;
30 | }
31 |
32 | //初始化
33 | - (instancetype)init {
34 | if (self = [super init]) {
35 | _locationManager = [[CLLocationManager alloc] init];
36 | _locationManager.desiredAccuracy = kCLLocationAccuracyBest;
37 | _locationManager.distanceFilter = 10.0;
38 | _locationManager.delegate = self;
39 |
40 | if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
41 | [_locationManager requestWhenInUseAuthorization];
42 | }
43 | }
44 | return self;
45 | }
46 |
47 | //开始
48 | - (void)startWithCompletionHandler:(LocationFetcherCompletionHandler)completion {
49 | self.completionHandler = completion;
50 |
51 | _locationAge = 0;
52 | [_locationManager startUpdatingLocation];
53 | }
54 |
55 | //完成
56 | - (void)locateCompleted:(LocationModel *)location {
57 | if (_completionHandler) {
58 | _completionHandler(location);
59 | }
60 | self.completionHandler = nil;//定位成功后销毁(避免产生保留环)
61 | }
62 |
63 | #pragma mark - CLLocationDelegate
64 | - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
65 | [_locationManager stopUpdatingLocation];//结束定位
66 |
67 | if (_locationAge != 0) return;
68 |
69 | //反地理编码
70 | CLGeocoder *geocoder = [[CLGeocoder alloc] init];
71 | [geocoder reverseGeocodeLocation:locations[0] completionHandler:^(NSArray * _Nullable placemarks, NSError * _Nullable error) {
72 |
73 | //将字典转为模型
74 | NSDictionary *dic = [self getInfoWithPlacemark:placemarks[0]];
75 | LocationModel *model = [LocationModel modelWithDictionary:dic];
76 |
77 | [self locateCompleted:model];
78 | }];
79 |
80 | _locationAge ++;
81 | }
82 |
83 | - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
84 | if ([error code] == kCLErrorDenied) {
85 | NSLog(@"错误:拒绝定位");
86 | }else if ([error code] == kCLErrorLocationUnknown) {
87 | NSLog(@"错误:无法获取定位");
88 | }else {
89 | NSLog(@"%@",error.localizedDescription);
90 | }
91 | }
92 |
93 | #pragma mark - 整理位置信息
94 | - (NSDictionary *)getInfoWithPlacemark:(CLPlacemark *)placemark {
95 |
96 | // 经纬度
97 | CLLocationCoordinate2D coordinate = placemark.location.coordinate;
98 | NSString *longitude = [NSString stringWithFormat:@"%f",coordinate.longitude];
99 | NSString *latitude = [NSString stringWithFormat:@"%f",coordinate.latitude];
100 |
101 | // 省/市/县(区)/街道/详细地址
102 | NSString *province = placemark.administrativeArea;
103 | NSString *city = placemark.locality;
104 | province = province ? province : placemark.locality;//若省不存在则为直辖市
105 | NSString *subCity = placemark.subLocality;
106 | NSString *street = placemark.addressDictionary[@"Street"];
107 |
108 | NSString *address;
109 | if ([province isEqualToString:city]) {
110 | address = [NSString stringWithFormat:@"%@%@%@",city,subCity,street];
111 | }else {
112 | address = [NSString stringWithFormat:@"%@%@%@%@",province,city,subCity,street];
113 | }
114 |
115 | NSDictionary *dic = @{@"longitude":longitude,
116 | @"latitude" :latitude,
117 | @"province" :province,
118 | @"city" :city,
119 | @"subCity" :subCity,
120 | @"street" :street,
121 | @"address" :address};
122 | return dic;
123 | }
124 |
125 | @end
126 |
127 |
128 |
129 | #pragma mark - 定位数据模型
130 | @implementation LocationModel
131 |
132 | - (void)setValue:(id)value forUndefinedKey:(NSString *)key {
133 |
134 | }
135 |
136 | @end
137 |
--------------------------------------------------------------------------------
/CCLocationDemo/CCLocationDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 8C0E5AAB2135942F0034D169 /* NSObject+Model.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C0E5AAA2135942F0034D169 /* NSObject+Model.m */; };
11 | 8C9D1C832113EA2600D5B8EF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9D1C822113EA2600D5B8EF /* AppDelegate.m */; };
12 | 8C9D1C862113EA2600D5B8EF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9D1C852113EA2600D5B8EF /* ViewController.m */; };
13 | 8C9D1C892113EA2600D5B8EF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8C9D1C872113EA2600D5B8EF /* Main.storyboard */; };
14 | 8C9D1C8B2113EA2800D5B8EF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8C9D1C8A2113EA2800D5B8EF /* Assets.xcassets */; };
15 | 8C9D1C8E2113EA2800D5B8EF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8C9D1C8C2113EA2800D5B8EF /* LaunchScreen.storyboard */; };
16 | 8C9D1C912113EA2800D5B8EF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9D1C902113EA2800D5B8EF /* main.m */; };
17 | 8CA77B38213574530002F67C /* CCLocationFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA77B37213574520002F67C /* CCLocationFetcher.m */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 8C9D1C972113EA2900D5B8EF /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 8C9D1C762113EA2600D5B8EF /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 8C9D1C7D2113EA2600D5B8EF;
26 | remoteInfo = CCLocationDemo;
27 | };
28 | 8C9D1CA22113EA2900D5B8EF /* PBXContainerItemProxy */ = {
29 | isa = PBXContainerItemProxy;
30 | containerPortal = 8C9D1C762113EA2600D5B8EF /* Project object */;
31 | proxyType = 1;
32 | remoteGlobalIDString = 8C9D1C7D2113EA2600D5B8EF;
33 | remoteInfo = CCLocationDemo;
34 | };
35 | /* End PBXContainerItemProxy section */
36 |
37 | /* Begin PBXFileReference section */
38 | 8C0E5AA92135942F0034D169 /* NSObject+Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Model.h"; sourceTree = ""; };
39 | 8C0E5AAA2135942F0034D169 /* NSObject+Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Model.m"; sourceTree = ""; };
40 | 8C9D1C7E2113EA2600D5B8EF /* CCLocationDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CCLocationDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
41 | 8C9D1C812113EA2600D5B8EF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
42 | 8C9D1C822113EA2600D5B8EF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
43 | 8C9D1C842113EA2600D5B8EF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
44 | 8C9D1C852113EA2600D5B8EF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
45 | 8C9D1C882113EA2600D5B8EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
46 | 8C9D1C8A2113EA2800D5B8EF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
47 | 8C9D1C8D2113EA2800D5B8EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
48 | 8C9D1C8F2113EA2800D5B8EF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 8C9D1C902113EA2800D5B8EF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
50 | 8C9D1C962113EA2900D5B8EF /* CCLocationDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CCLocationDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 8C9D1CA12113EA2900D5B8EF /* CCLocationDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CCLocationDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
52 | 8CA77B36213574520002F67C /* CCLocationFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLocationFetcher.h; sourceTree = ""; };
53 | 8CA77B37213574520002F67C /* CCLocationFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCLocationFetcher.m; sourceTree = ""; };
54 | /* End PBXFileReference section */
55 |
56 | /* Begin PBXFrameworksBuildPhase section */
57 | 8C9D1C7B2113EA2600D5B8EF /* Frameworks */ = {
58 | isa = PBXFrameworksBuildPhase;
59 | buildActionMask = 2147483647;
60 | files = (
61 | );
62 | runOnlyForDeploymentPostprocessing = 0;
63 | };
64 | 8C9D1C932113EA2900D5B8EF /* Frameworks */ = {
65 | isa = PBXFrameworksBuildPhase;
66 | buildActionMask = 2147483647;
67 | files = (
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | 8C9D1C9E2113EA2900D5B8EF /* Frameworks */ = {
72 | isa = PBXFrameworksBuildPhase;
73 | buildActionMask = 2147483647;
74 | files = (
75 | );
76 | runOnlyForDeploymentPostprocessing = 0;
77 | };
78 | /* End PBXFrameworksBuildPhase section */
79 |
80 | /* Begin PBXGroup section */
81 | 8C9D1C752113EA2600D5B8EF = {
82 | isa = PBXGroup;
83 | children = (
84 | 8C9D1C802113EA2600D5B8EF /* CCLocationDemo */,
85 | 8C9D1C7F2113EA2600D5B8EF /* Products */,
86 | );
87 | sourceTree = "";
88 | };
89 | 8C9D1C7F2113EA2600D5B8EF /* Products */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 8C9D1C7E2113EA2600D5B8EF /* CCLocationDemo.app */,
93 | 8C9D1C962113EA2900D5B8EF /* CCLocationDemoTests.xctest */,
94 | 8C9D1CA12113EA2900D5B8EF /* CCLocationDemoUITests.xctest */,
95 | );
96 | name = Products;
97 | sourceTree = "";
98 | };
99 | 8C9D1C802113EA2600D5B8EF /* CCLocationDemo */ = {
100 | isa = PBXGroup;
101 | children = (
102 | 8CA77B35213574520002F67C /* CCLocationFetcher */,
103 | 8C9D1C812113EA2600D5B8EF /* AppDelegate.h */,
104 | 8C9D1C822113EA2600D5B8EF /* AppDelegate.m */,
105 | 8C9D1C842113EA2600D5B8EF /* ViewController.h */,
106 | 8C9D1C852113EA2600D5B8EF /* ViewController.m */,
107 | 8C9D1C872113EA2600D5B8EF /* Main.storyboard */,
108 | 8C9D1C8A2113EA2800D5B8EF /* Assets.xcassets */,
109 | 8C9D1C8C2113EA2800D5B8EF /* LaunchScreen.storyboard */,
110 | 8C9D1C8F2113EA2800D5B8EF /* Info.plist */,
111 | 8C9D1C902113EA2800D5B8EF /* main.m */,
112 | );
113 | path = CCLocationDemo;
114 | sourceTree = "";
115 | };
116 | 8CA77B35213574520002F67C /* CCLocationFetcher */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 8CA77B36213574520002F67C /* CCLocationFetcher.h */,
120 | 8CA77B37213574520002F67C /* CCLocationFetcher.m */,
121 | 8C0E5AA92135942F0034D169 /* NSObject+Model.h */,
122 | 8C0E5AAA2135942F0034D169 /* NSObject+Model.m */,
123 | );
124 | name = CCLocationFetcher;
125 | path = ../../CCLocationFetcher;
126 | sourceTree = "";
127 | };
128 | /* End PBXGroup section */
129 |
130 | /* Begin PBXNativeTarget section */
131 | 8C9D1C7D2113EA2600D5B8EF /* CCLocationDemo */ = {
132 | isa = PBXNativeTarget;
133 | buildConfigurationList = 8C9D1CAA2113EA2900D5B8EF /* Build configuration list for PBXNativeTarget "CCLocationDemo" */;
134 | buildPhases = (
135 | 8C9D1C7A2113EA2600D5B8EF /* Sources */,
136 | 8C9D1C7B2113EA2600D5B8EF /* Frameworks */,
137 | 8C9D1C7C2113EA2600D5B8EF /* Resources */,
138 | );
139 | buildRules = (
140 | );
141 | dependencies = (
142 | );
143 | name = CCLocationDemo;
144 | productName = CCLocationDemo;
145 | productReference = 8C9D1C7E2113EA2600D5B8EF /* CCLocationDemo.app */;
146 | productType = "com.apple.product-type.application";
147 | };
148 | 8C9D1C952113EA2900D5B8EF /* CCLocationDemoTests */ = {
149 | isa = PBXNativeTarget;
150 | buildConfigurationList = 8C9D1CAD2113EA2900D5B8EF /* Build configuration list for PBXNativeTarget "CCLocationDemoTests" */;
151 | buildPhases = (
152 | 8C9D1C922113EA2900D5B8EF /* Sources */,
153 | 8C9D1C932113EA2900D5B8EF /* Frameworks */,
154 | 8C9D1C942113EA2900D5B8EF /* Resources */,
155 | );
156 | buildRules = (
157 | );
158 | dependencies = (
159 | 8C9D1C982113EA2900D5B8EF /* PBXTargetDependency */,
160 | );
161 | name = CCLocationDemoTests;
162 | productName = CCLocationDemoTests;
163 | productReference = 8C9D1C962113EA2900D5B8EF /* CCLocationDemoTests.xctest */;
164 | productType = "com.apple.product-type.bundle.unit-test";
165 | };
166 | 8C9D1CA02113EA2900D5B8EF /* CCLocationDemoUITests */ = {
167 | isa = PBXNativeTarget;
168 | buildConfigurationList = 8C9D1CB02113EA2900D5B8EF /* Build configuration list for PBXNativeTarget "CCLocationDemoUITests" */;
169 | buildPhases = (
170 | 8C9D1C9D2113EA2900D5B8EF /* Sources */,
171 | 8C9D1C9E2113EA2900D5B8EF /* Frameworks */,
172 | 8C9D1C9F2113EA2900D5B8EF /* Resources */,
173 | );
174 | buildRules = (
175 | );
176 | dependencies = (
177 | 8C9D1CA32113EA2900D5B8EF /* PBXTargetDependency */,
178 | );
179 | name = CCLocationDemoUITests;
180 | productName = CCLocationDemoUITests;
181 | productReference = 8C9D1CA12113EA2900D5B8EF /* CCLocationDemoUITests.xctest */;
182 | productType = "com.apple.product-type.bundle.ui-testing";
183 | };
184 | /* End PBXNativeTarget section */
185 |
186 | /* Begin PBXProject section */
187 | 8C9D1C762113EA2600D5B8EF /* Project object */ = {
188 | isa = PBXProject;
189 | attributes = {
190 | LastUpgradeCheck = 0940;
191 | ORGANIZATIONNAME = RachalPersonal;
192 | TargetAttributes = {
193 | 8C9D1C7D2113EA2600D5B8EF = {
194 | CreatedOnToolsVersion = 9.4.1;
195 | };
196 | 8C9D1C952113EA2900D5B8EF = {
197 | CreatedOnToolsVersion = 9.4.1;
198 | TestTargetID = 8C9D1C7D2113EA2600D5B8EF;
199 | };
200 | 8C9D1CA02113EA2900D5B8EF = {
201 | CreatedOnToolsVersion = 9.4.1;
202 | TestTargetID = 8C9D1C7D2113EA2600D5B8EF;
203 | };
204 | };
205 | };
206 | buildConfigurationList = 8C9D1C792113EA2600D5B8EF /* Build configuration list for PBXProject "CCLocationDemo" */;
207 | compatibilityVersion = "Xcode 9.3";
208 | developmentRegion = en;
209 | hasScannedForEncodings = 0;
210 | knownRegions = (
211 | en,
212 | Base,
213 | );
214 | mainGroup = 8C9D1C752113EA2600D5B8EF;
215 | productRefGroup = 8C9D1C7F2113EA2600D5B8EF /* Products */;
216 | projectDirPath = "";
217 | projectRoot = "";
218 | targets = (
219 | 8C9D1C7D2113EA2600D5B8EF /* CCLocationDemo */,
220 | 8C9D1C952113EA2900D5B8EF /* CCLocationDemoTests */,
221 | 8C9D1CA02113EA2900D5B8EF /* CCLocationDemoUITests */,
222 | );
223 | };
224 | /* End PBXProject section */
225 |
226 | /* Begin PBXResourcesBuildPhase section */
227 | 8C9D1C7C2113EA2600D5B8EF /* Resources */ = {
228 | isa = PBXResourcesBuildPhase;
229 | buildActionMask = 2147483647;
230 | files = (
231 | 8C9D1C8E2113EA2800D5B8EF /* LaunchScreen.storyboard in Resources */,
232 | 8C9D1C8B2113EA2800D5B8EF /* Assets.xcassets in Resources */,
233 | 8C9D1C892113EA2600D5B8EF /* Main.storyboard in Resources */,
234 | );
235 | runOnlyForDeploymentPostprocessing = 0;
236 | };
237 | 8C9D1C942113EA2900D5B8EF /* Resources */ = {
238 | isa = PBXResourcesBuildPhase;
239 | buildActionMask = 2147483647;
240 | files = (
241 | );
242 | runOnlyForDeploymentPostprocessing = 0;
243 | };
244 | 8C9D1C9F2113EA2900D5B8EF /* Resources */ = {
245 | isa = PBXResourcesBuildPhase;
246 | buildActionMask = 2147483647;
247 | files = (
248 | );
249 | runOnlyForDeploymentPostprocessing = 0;
250 | };
251 | /* End PBXResourcesBuildPhase section */
252 |
253 | /* Begin PBXSourcesBuildPhase section */
254 | 8C9D1C7A2113EA2600D5B8EF /* Sources */ = {
255 | isa = PBXSourcesBuildPhase;
256 | buildActionMask = 2147483647;
257 | files = (
258 | 8C9D1C862113EA2600D5B8EF /* ViewController.m in Sources */,
259 | 8C9D1C912113EA2800D5B8EF /* main.m in Sources */,
260 | 8CA77B38213574530002F67C /* CCLocationFetcher.m in Sources */,
261 | 8C0E5AAB2135942F0034D169 /* NSObject+Model.m in Sources */,
262 | 8C9D1C832113EA2600D5B8EF /* AppDelegate.m in Sources */,
263 | );
264 | runOnlyForDeploymentPostprocessing = 0;
265 | };
266 | 8C9D1C922113EA2900D5B8EF /* Sources */ = {
267 | isa = PBXSourcesBuildPhase;
268 | buildActionMask = 2147483647;
269 | files = (
270 | );
271 | runOnlyForDeploymentPostprocessing = 0;
272 | };
273 | 8C9D1C9D2113EA2900D5B8EF /* Sources */ = {
274 | isa = PBXSourcesBuildPhase;
275 | buildActionMask = 2147483647;
276 | files = (
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | };
280 | /* End PBXSourcesBuildPhase section */
281 |
282 | /* Begin PBXTargetDependency section */
283 | 8C9D1C982113EA2900D5B8EF /* PBXTargetDependency */ = {
284 | isa = PBXTargetDependency;
285 | target = 8C9D1C7D2113EA2600D5B8EF /* CCLocationDemo */;
286 | targetProxy = 8C9D1C972113EA2900D5B8EF /* PBXContainerItemProxy */;
287 | };
288 | 8C9D1CA32113EA2900D5B8EF /* PBXTargetDependency */ = {
289 | isa = PBXTargetDependency;
290 | target = 8C9D1C7D2113EA2600D5B8EF /* CCLocationDemo */;
291 | targetProxy = 8C9D1CA22113EA2900D5B8EF /* PBXContainerItemProxy */;
292 | };
293 | /* End PBXTargetDependency section */
294 |
295 | /* Begin PBXVariantGroup section */
296 | 8C9D1C872113EA2600D5B8EF /* Main.storyboard */ = {
297 | isa = PBXVariantGroup;
298 | children = (
299 | 8C9D1C882113EA2600D5B8EF /* Base */,
300 | );
301 | name = Main.storyboard;
302 | sourceTree = "";
303 | };
304 | 8C9D1C8C2113EA2800D5B8EF /* LaunchScreen.storyboard */ = {
305 | isa = PBXVariantGroup;
306 | children = (
307 | 8C9D1C8D2113EA2800D5B8EF /* Base */,
308 | );
309 | name = LaunchScreen.storyboard;
310 | sourceTree = "";
311 | };
312 | /* End PBXVariantGroup section */
313 |
314 | /* Begin XCBuildConfiguration section */
315 | 8C9D1CA82113EA2900D5B8EF /* Debug */ = {
316 | isa = XCBuildConfiguration;
317 | buildSettings = {
318 | ALWAYS_SEARCH_USER_PATHS = NO;
319 | CLANG_ANALYZER_NONNULL = YES;
320 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
322 | CLANG_CXX_LIBRARY = "libc++";
323 | CLANG_ENABLE_MODULES = YES;
324 | CLANG_ENABLE_OBJC_ARC = YES;
325 | CLANG_ENABLE_OBJC_WEAK = YES;
326 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
327 | CLANG_WARN_BOOL_CONVERSION = YES;
328 | CLANG_WARN_COMMA = YES;
329 | CLANG_WARN_CONSTANT_CONVERSION = YES;
330 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
331 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
332 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
333 | CLANG_WARN_EMPTY_BODY = YES;
334 | CLANG_WARN_ENUM_CONVERSION = YES;
335 | CLANG_WARN_INFINITE_RECURSION = YES;
336 | CLANG_WARN_INT_CONVERSION = YES;
337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
338 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
339 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
341 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
342 | CLANG_WARN_STRICT_PROTOTYPES = YES;
343 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
344 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
345 | CLANG_WARN_UNREACHABLE_CODE = YES;
346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
347 | CODE_SIGN_IDENTITY = "iPhone Developer";
348 | COPY_PHASE_STRIP = NO;
349 | DEBUG_INFORMATION_FORMAT = dwarf;
350 | ENABLE_STRICT_OBJC_MSGSEND = YES;
351 | ENABLE_TESTABILITY = YES;
352 | GCC_C_LANGUAGE_STANDARD = gnu11;
353 | GCC_DYNAMIC_NO_PIC = NO;
354 | GCC_NO_COMMON_BLOCKS = YES;
355 | GCC_OPTIMIZATION_LEVEL = 0;
356 | GCC_PREPROCESSOR_DEFINITIONS = (
357 | "DEBUG=1",
358 | "$(inherited)",
359 | );
360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
362 | GCC_WARN_UNDECLARED_SELECTOR = YES;
363 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
364 | GCC_WARN_UNUSED_FUNCTION = YES;
365 | GCC_WARN_UNUSED_VARIABLE = YES;
366 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
367 | MTL_ENABLE_DEBUG_INFO = YES;
368 | ONLY_ACTIVE_ARCH = YES;
369 | SDKROOT = iphoneos;
370 | };
371 | name = Debug;
372 | };
373 | 8C9D1CA92113EA2900D5B8EF /* Release */ = {
374 | isa = XCBuildConfiguration;
375 | buildSettings = {
376 | ALWAYS_SEARCH_USER_PATHS = NO;
377 | CLANG_ANALYZER_NONNULL = YES;
378 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
379 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
380 | CLANG_CXX_LIBRARY = "libc++";
381 | CLANG_ENABLE_MODULES = YES;
382 | CLANG_ENABLE_OBJC_ARC = YES;
383 | CLANG_ENABLE_OBJC_WEAK = YES;
384 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
385 | CLANG_WARN_BOOL_CONVERSION = YES;
386 | CLANG_WARN_COMMA = YES;
387 | CLANG_WARN_CONSTANT_CONVERSION = YES;
388 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
389 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
390 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
391 | CLANG_WARN_EMPTY_BODY = YES;
392 | CLANG_WARN_ENUM_CONVERSION = YES;
393 | CLANG_WARN_INFINITE_RECURSION = YES;
394 | CLANG_WARN_INT_CONVERSION = YES;
395 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
396 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
397 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
400 | CLANG_WARN_STRICT_PROTOTYPES = YES;
401 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
402 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
403 | CLANG_WARN_UNREACHABLE_CODE = YES;
404 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
405 | CODE_SIGN_IDENTITY = "iPhone Developer";
406 | COPY_PHASE_STRIP = NO;
407 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
408 | ENABLE_NS_ASSERTIONS = NO;
409 | ENABLE_STRICT_OBJC_MSGSEND = YES;
410 | GCC_C_LANGUAGE_STANDARD = gnu11;
411 | GCC_NO_COMMON_BLOCKS = YES;
412 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
413 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
414 | GCC_WARN_UNDECLARED_SELECTOR = YES;
415 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
416 | GCC_WARN_UNUSED_FUNCTION = YES;
417 | GCC_WARN_UNUSED_VARIABLE = YES;
418 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
419 | MTL_ENABLE_DEBUG_INFO = NO;
420 | SDKROOT = iphoneos;
421 | VALIDATE_PRODUCT = YES;
422 | };
423 | name = Release;
424 | };
425 | 8C9D1CAB2113EA2900D5B8EF /* Debug */ = {
426 | isa = XCBuildConfiguration;
427 | buildSettings = {
428 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
429 | CLANG_CXX_LIBRARY = "compiler-default";
430 | CODE_SIGN_STYLE = Automatic;
431 | DEVELOPMENT_TEAM = WJLPEH3MDZ;
432 | INFOPLIST_FILE = CCLocationDemo/Info.plist;
433 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
434 | LD_RUNPATH_SEARCH_PATHS = (
435 | "$(inherited)",
436 | "@executable_path/Frameworks",
437 | );
438 | PRODUCT_BUNDLE_IDENTIFIER = com.zrc.CCLocation;
439 | PRODUCT_NAME = "$(TARGET_NAME)";
440 | TARGETED_DEVICE_FAMILY = "1,2";
441 | };
442 | name = Debug;
443 | };
444 | 8C9D1CAC2113EA2900D5B8EF /* Release */ = {
445 | isa = XCBuildConfiguration;
446 | buildSettings = {
447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
448 | CLANG_CXX_LIBRARY = "compiler-default";
449 | CODE_SIGN_STYLE = Automatic;
450 | DEVELOPMENT_TEAM = WJLPEH3MDZ;
451 | INFOPLIST_FILE = CCLocationDemo/Info.plist;
452 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
453 | LD_RUNPATH_SEARCH_PATHS = (
454 | "$(inherited)",
455 | "@executable_path/Frameworks",
456 | );
457 | PRODUCT_BUNDLE_IDENTIFIER = com.zrc.CCLocation;
458 | PRODUCT_NAME = "$(TARGET_NAME)";
459 | TARGETED_DEVICE_FAMILY = "1,2";
460 | };
461 | name = Release;
462 | };
463 | 8C9D1CAE2113EA2900D5B8EF /* Debug */ = {
464 | isa = XCBuildConfiguration;
465 | buildSettings = {
466 | BUNDLE_LOADER = "$(TEST_HOST)";
467 | CODE_SIGN_STYLE = Automatic;
468 | INFOPLIST_FILE = CCLocationDemoTests/Info.plist;
469 | LD_RUNPATH_SEARCH_PATHS = (
470 | "$(inherited)",
471 | "@executable_path/Frameworks",
472 | "@loader_path/Frameworks",
473 | );
474 | PRODUCT_BUNDLE_IDENTIFIER = com.zrc.CCLocationDemoTests;
475 | PRODUCT_NAME = "$(TARGET_NAME)";
476 | TARGETED_DEVICE_FAMILY = "1,2";
477 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CCLocationDemo.app/CCLocationDemo";
478 | };
479 | name = Debug;
480 | };
481 | 8C9D1CAF2113EA2900D5B8EF /* Release */ = {
482 | isa = XCBuildConfiguration;
483 | buildSettings = {
484 | BUNDLE_LOADER = "$(TEST_HOST)";
485 | CODE_SIGN_STYLE = Automatic;
486 | INFOPLIST_FILE = CCLocationDemoTests/Info.plist;
487 | LD_RUNPATH_SEARCH_PATHS = (
488 | "$(inherited)",
489 | "@executable_path/Frameworks",
490 | "@loader_path/Frameworks",
491 | );
492 | PRODUCT_BUNDLE_IDENTIFIER = com.zrc.CCLocationDemoTests;
493 | PRODUCT_NAME = "$(TARGET_NAME)";
494 | TARGETED_DEVICE_FAMILY = "1,2";
495 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CCLocationDemo.app/CCLocationDemo";
496 | };
497 | name = Release;
498 | };
499 | 8C9D1CB12113EA2900D5B8EF /* Debug */ = {
500 | isa = XCBuildConfiguration;
501 | buildSettings = {
502 | CODE_SIGN_STYLE = Automatic;
503 | INFOPLIST_FILE = CCLocationDemoUITests/Info.plist;
504 | LD_RUNPATH_SEARCH_PATHS = (
505 | "$(inherited)",
506 | "@executable_path/Frameworks",
507 | "@loader_path/Frameworks",
508 | );
509 | PRODUCT_BUNDLE_IDENTIFIER = com.zrc.CCLocationDemoUITests;
510 | PRODUCT_NAME = "$(TARGET_NAME)";
511 | TARGETED_DEVICE_FAMILY = "1,2";
512 | TEST_TARGET_NAME = CCLocationDemo;
513 | };
514 | name = Debug;
515 | };
516 | 8C9D1CB22113EA2900D5B8EF /* Release */ = {
517 | isa = XCBuildConfiguration;
518 | buildSettings = {
519 | CODE_SIGN_STYLE = Automatic;
520 | INFOPLIST_FILE = CCLocationDemoUITests/Info.plist;
521 | LD_RUNPATH_SEARCH_PATHS = (
522 | "$(inherited)",
523 | "@executable_path/Frameworks",
524 | "@loader_path/Frameworks",
525 | );
526 | PRODUCT_BUNDLE_IDENTIFIER = com.zrc.CCLocationDemoUITests;
527 | PRODUCT_NAME = "$(TARGET_NAME)";
528 | TARGETED_DEVICE_FAMILY = "1,2";
529 | TEST_TARGET_NAME = CCLocationDemo;
530 | };
531 | name = Release;
532 | };
533 | /* End XCBuildConfiguration section */
534 |
535 | /* Begin XCConfigurationList section */
536 | 8C9D1C792113EA2600D5B8EF /* Build configuration list for PBXProject "CCLocationDemo" */ = {
537 | isa = XCConfigurationList;
538 | buildConfigurations = (
539 | 8C9D1CA82113EA2900D5B8EF /* Debug */,
540 | 8C9D1CA92113EA2900D5B8EF /* Release */,
541 | );
542 | defaultConfigurationIsVisible = 0;
543 | defaultConfigurationName = Release;
544 | };
545 | 8C9D1CAA2113EA2900D5B8EF /* Build configuration list for PBXNativeTarget "CCLocationDemo" */ = {
546 | isa = XCConfigurationList;
547 | buildConfigurations = (
548 | 8C9D1CAB2113EA2900D5B8EF /* Debug */,
549 | 8C9D1CAC2113EA2900D5B8EF /* Release */,
550 | );
551 | defaultConfigurationIsVisible = 0;
552 | defaultConfigurationName = Release;
553 | };
554 | 8C9D1CAD2113EA2900D5B8EF /* Build configuration list for PBXNativeTarget "CCLocationDemoTests" */ = {
555 | isa = XCConfigurationList;
556 | buildConfigurations = (
557 | 8C9D1CAE2113EA2900D5B8EF /* Debug */,
558 | 8C9D1CAF2113EA2900D5B8EF /* Release */,
559 | );
560 | defaultConfigurationIsVisible = 0;
561 | defaultConfigurationName = Release;
562 | };
563 | 8C9D1CB02113EA2900D5B8EF /* Build configuration list for PBXNativeTarget "CCLocationDemoUITests" */ = {
564 | isa = XCConfigurationList;
565 | buildConfigurations = (
566 | 8C9D1CB12113EA2900D5B8EF /* Debug */,
567 | 8C9D1CB22113EA2900D5B8EF /* Release */,
568 | );
569 | defaultConfigurationIsVisible = 0;
570 | defaultConfigurationName = Release;
571 | };
572 | /* End XCConfigurationList section */
573 | };
574 | rootObject = 8C9D1C762113EA2600D5B8EF /* Project object */;
575 | }
576 |
--------------------------------------------------------------------------------