Commit 81dbaa5e9b3f8069593f28c4e5d7414d8991ab11

Authored by 梁星国
1 parent a7efe25c

提交

CNLiveLocationManager.podspec
... ... @@ -28,7 +28,7 @@ Pod::Spec.new do |s|
28 28 s.source = { :git => 'https://github.com/jyyjkt/CNLiveLocationManager.git', :tag => s.version.to_s }
29 29 # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
30 30  
31   - s.ios.deployment_target = '8.0'
  31 + s.ios.deployment_target = '9.0'
32 32  
33 33 s.source_files = 'CNLiveLocationManager/Classes/**/*'
34 34  
... ...
Example/CNLiveLocationManager/CNLiveLocationManager-Info.plist
... ... @@ -45,5 +45,7 @@
45 45 <string>UIInterfaceOrientationLandscapeLeft</string>
46 46 <string>UIInterfaceOrientationLandscapeRight</string>
47 47 </array>
  48 + <key>NSLocationWhenInUseUsageDescription</key><string>需要定位</string>
  49 + <key>NSLocationAlwaysUsageDescription</key><string>需要定位</string>
48 50 </dict>
49 51 </plist>
... ...
Example/CNLiveLocationManager/CNLiveViewController.m
... ... @@ -7,6 +7,7 @@
7 7 //
8 8  
9 9 #import "CNLiveViewController.h"
  10 +#import <CNLiveLocationManager.h>
10 11  
11 12 @interface CNLiveViewController ()
12 13  
... ... @@ -17,7 +18,28 @@
17 18 - (void)viewDidLoad
18 19 {
19 20 [super viewDidLoad];
20   - // Do any additional setup after loading the view, typically from a nib.
  21 +
  22 + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  23 + [self.view addSubview:button];
  24 + button.frame = CGRectMake(100, 100, 100, 100);
  25 + [button setBackgroundColor:[UIColor yellowColor]];
  26 + [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
  27 +
  28 +}
  29 +
  30 +#pragma mark -
  31 +- (void)buttonAction:(UIButton *)button {
  32 +
  33 + [CNLiveLocationManager getLocation:^(CLLocationDegrees latitude, CLLocationDegrees longitude) {
  34 +
  35 + } failure:^(id error) {
  36 +
  37 + }];
  38 +
  39 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  40 + [CNLiveLocationManager stop];
  41 + });
  42 +
21 43 }
22 44  
23 45 - (void)didReceiveMemoryWarning
... ...