Sfoglia il codice sorgente

1.修改iOS Apex & Drivers推送处理以及后台定位。
2.修改iOS Apex & Drivers Detail Action处理。

Pen Li 8 anni fa
parent
commit
6eb38fd32e

+ 6 - 0
Redant Drivers/Apex And Drivers.xcodeproj/project.pbxproj

@@ -21,6 +21,7 @@
 		4205FD6C20C13E0700DB42B4 /* RAHomeViewController+HomeTableDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4205FD6B20C13E0700DB42B4 /* RAHomeViewController+HomeTableDelegate.m */; };
 		4205FD6F20C13E2700DB42B4 /* RAHomeViewController+HomeTableDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4205FD6E20C13E2700DB42B4 /* RAHomeViewController+HomeTableDataSource.m */; };
 		4205FD7220C1465400DB42B4 /* RAHomeOrderModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4205FD7120C1465400DB42B4 /* RAHomeOrderModel.m */; };
+		423C6A4E20C909FC00455E27 /* RANotificationNameCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 423C6A4D20C909FC00455E27 /* RANotificationNameCenter.m */; };
 		424204DC20C61561005AEED9 /* RAQRCodeScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 424204DB20C61561005AEED9 /* RAQRCodeScannerViewController.m */; };
 		424204DE20C6156E005AEED9 /* QRCode.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 424204DD20C6156E005AEED9 /* QRCode.storyboard */; };
 		424204E220C65817005AEED9 /* RACameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 424204E120C65817005AEED9 /* RACameraViewController.m */; };
@@ -128,6 +129,8 @@
 		4205FD6E20C13E2700DB42B4 /* RAHomeViewController+HomeTableDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RAHomeViewController+HomeTableDataSource.m"; sourceTree = "<group>"; };
 		4205FD7020C1465400DB42B4 /* RAHomeOrderModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAHomeOrderModel.h; sourceTree = "<group>"; };
 		4205FD7120C1465400DB42B4 /* RAHomeOrderModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RAHomeOrderModel.m; sourceTree = "<group>"; };
+		423C6A4C20C909FC00455E27 /* RANotificationNameCenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RANotificationNameCenter.h; sourceTree = "<group>"; };
+		423C6A4D20C909FC00455E27 /* RANotificationNameCenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RANotificationNameCenter.m; sourceTree = "<group>"; };
 		424204DA20C61561005AEED9 /* RAQRCodeScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAQRCodeScannerViewController.h; sourceTree = "<group>"; };
 		424204DB20C61561005AEED9 /* RAQRCodeScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RAQRCodeScannerViewController.m; sourceTree = "<group>"; };
 		424204DD20C6156E005AEED9 /* QRCode.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = QRCode.storyboard; sourceTree = "<group>"; };
@@ -688,6 +691,8 @@
 				425B97D220C7B7E100B35713 /* Upload */,
 				425B97C920C7895F00B35713 /* RASingleton.h */,
 				425B97CA20C7895F00B35713 /* RASingleton.m */,
+				423C6A4C20C909FC00455E27 /* RANotificationNameCenter.h */,
+				423C6A4D20C909FC00455E27 /* RANotificationNameCenter.m */,
 				71EAA33120B9571B002F003C /* AppDelegate.h */,
 				71EAA33220B9571B002F003C /* AppDelegate.m */,
 				4205FD5D20C134B400DB42B4 /* Other */,
@@ -828,6 +833,7 @@
 				42D8B8D220C267C7001C125F /* RADetailActionsLayout.m in Sources */,
 				425B97D020C78ABE00B35713 /* RAUploadManager.m in Sources */,
 				42D8B8B420C2463D001C125F /* RADetailLocationCell.m in Sources */,
+				423C6A4E20C909FC00455E27 /* RANotificationNameCenter.m in Sources */,
 				42529D3A20C0EA3F000C0F4D /* mztools.c in Sources */,
 				4205FD5C20C1316200DB42B4 /* RABaseViewController.m in Sources */,
 				425B97E220C7BC4A00B35713 /* RAUploadListViewController.m in Sources */,

+ 117 - 11
Redant Drivers/Apex And Drivers/AppDelegate.m

@@ -9,10 +9,13 @@
 #import <UserNotifications/UserNotifications.h>
 #import "LoginViewController.h"
 #import "RAHomeViewController.h"
+#import <CoreLocation/CoreLocation.h>
 
-@interface AppDelegate ()<UNUserNotificationCenterDelegate>
+@interface AppDelegate ()<UNUserNotificationCenterDelegate,CLLocationManagerDelegate>
 
 @property (nonatomic,weak) UINavigationController *rootVC;
+@property (nonatomic,strong) CLLocationManager *locationManager;
+@property (nonatomic,strong) CLLocation *currentLocation;
 
 @end
 
@@ -37,6 +40,38 @@
     }
 }
 
+- (void)startLocation {
+    
+    if (self.locationManager) {
+        return;
+    }
+    self.locationManager = [[CLLocationManager alloc] init];
+    self.locationManager.delegate = self;
+    self.locationManager.allowsBackgroundLocationUpdates = YES;
+    self.locationManager.pausesLocationUpdatesAutomatically = NO; // 是否允许系统自动暂停定位
+    self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;//设置定位精度
+    self.locationManager.distanceFilter = kCLDistanceFilterNone; //不需要移动都可以刷新,不然不移动就不会执行定位,不定位的话,那么后台进程也就挂起了
+    [self.locationManager requestAlwaysAuthorization];
+    [self.locationManager startUpdatingLocation];
+}
+
+- (void)stopLocation {
+    if (self.locationManager == nil) {
+        return;
+    }
+    [self.locationManager stopUpdatingLocation];
+    self.locationManager = nil;
+}
+
+- (void)reportLocation:(CLLocation *)location {
+    
+    if (location) {
+        
+    } else {
+        
+    }
+}
+
 #pragma mark - AppDelegate
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@@ -59,15 +94,17 @@
     
     [self.window makeKeyAndVisible];
     
+    [self startLocation];
+    
     //消息推送注册
     UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter];
     [center setDelegate:self];
     UNAuthorizationOptions type = UNAuthorizationOptionBadge|UNAuthorizationOptionSound|UNAuthorizationOptionAlert;
     [center requestAuthorizationWithOptions:type completionHandler:^(BOOL granted, NSError * _Nullable error) {
         if (granted) {
-            NSLog(@"注册成功");
+            NSLog(@"推送通知授权成功");
         }else{
-            NSLog(@"注册失败");
+            NSLog(@"推送通知授权失败");
         }
     }];
     [application registerForRemoteNotifications];
@@ -104,29 +141,98 @@
 
 //处理通知
 - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
-    
+  
+    // 程序在前台收到通知
     UNNotificationRequest *request = notification.request;
     NSDictionary *userInfo = request.content.userInfo;
     
     if ([request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
-        NSLog(@"收到了一个远程推送:%@",userInfo);
-    }
-    else{
-        NSLog(@"收到了一个本地推送:%@",userInfo);
+        NSLog(@"收到远程通知: %@",userInfo);
+    } else {
+        NSLog(@"收到本地通知: %@",userInfo);
     }
     
-    completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
+    // UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert
+    completionHandler(UNNotificationPresentationOptionNone);
 }
 
 - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
     NSLog(@"接收到推送内容==%@", response.notification.request.content.userInfo);
-    
+    // 点击通知
     completionHandler();
 }
 
 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
 
+    /**
+     静默推送alert为空
+     {
+        "aps" : {
+        "alert" : "",
+        "content-available" : 1
+        }
+     }
+     */
+    
+    // "content-available" : 1 收到通知
     NSLog(@"收到静默推送: %@",userInfo);
-    completionHandler(UIBackgroundFetchResultNewData);
+    if (userInfo) {
+        
+        NSDictionary *aps = [userInfo objectForKey:@"aps"];
+        NSInteger report_location = [[aps objectForKey:@"report-location"] integerValue];
+        if (report_location == 1) {
+            
+            [self reportLocation:self.currentLocation];
+            completionHandler(UIBackgroundFetchResultNewData);
+        } else {
+            /**
+             {
+                "aps" : {
+                    "alert" : {
+                    "title" : "Notification",
+                    "body" : "You have a new order"
+                    },
+                "new-order" : 1,
+                "sound" : "default",
+                "content-available" : 1
+                }
+             }
+             */
+            
+            NSInteger new_order = [[aps objectForKey:@"new-order"] integerValue];
+            if (new_order) {
+                
+                [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationNewOrder object:nil];
+            }
+            completionHandler(UIBackgroundFetchResultNewData);
+        }
+    } else {
+        completionHandler(UIBackgroundFetchResultNoData);
+    }
+}
+
+#pragma mark - LocationManager Delegate
+
+- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations {
+    if (locations.count) {
+        self.currentLocation = [locations lastObject];
+        
+        NSLog(@"location: %f, %f",self.currentLocation.coordinate.latitude,self.currentLocation.coordinate.longitude);
+        
+        // 省电,停止不能超过三分钟
+//        [self performSelector:@selector(stopLocation) withObject:nil afterDelay:10]; // 获取到位置10s后关闭位置服务
+//        [self performSelector:@selector(startLocation) withObject:nil afterDelay:120]; // 获取到位置120s后重新打开位置服务
+        CLLocationDistance distance = 500;
+        NSTimeInterval time = 60;
+        [manager allowDeferredLocationUpdatesUntilTraveled:distance timeout:time];
+    }
+}
+
+- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
+    
+    if (status == kCLAuthorizationStatusDenied) {
+        self.currentLocation = nil;
+    }
 }
+
 @end

+ 8 - 1
Redant Drivers/Apex And Drivers/Detail/Model/Collection/RADetailActionModel.h

@@ -24,6 +24,13 @@ typedef enum {
 @property (nonatomic,assign) RADetailActionSubType actionSubType;
 @property (nonatomic,copy) NSString *actionTitle;
 
-@property (nonatomic,strong,readonly) NSArray <RADetailActionSelectionModel *> *enums;///< actionSubType == RADetailActionSubTypeEnum
+#pragma mark - actionType == RADetailActionTypeLocal && actionSubType == RADetailActionSubTypeEnum
+
+@property (nonatomic,strong,readonly) NSArray <RADetailActionSelectionModel *> *enums;///<
+
+#pragma mark - actionType == RADetailActionTypeRemote
+
+@property (nonatomic,copy) NSString *url;///<
+@property (nonatomic,strong) NSMutableDictionary *params;///<
 
 @end

+ 7 - 0
Redant Drivers/Apex And Drivers/Detail/Model/Collection/RADetailActionModel.m

@@ -29,4 +29,11 @@
     _enums = modelArr;
 }
 
+- (void)setParams:(NSMutableDictionary *)params {
+    if (![params isKindOfClass:[NSMutableDictionary class]]) {
+        params = [params mutableCopy];
+    }
+    _params = params;
+}
+
 @end

+ 58 - 1
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController+TableViewDataSource.m

@@ -24,6 +24,7 @@
 #import "RADetailActionSelectionModel.h"
 #import "RAOrderEditViewController.h"
 
+#import "RAProgressHUD.h"
 
 
 
@@ -132,7 +133,7 @@
 - (void)actionsCell:(RADetailActionsCell *)cell didClickSubCell:(RADetailActionSubCell *)subCell forModel:(RADetailActionModel *)model {
     switch (model.actionType) {
         case RADetailActionTypeRemote: {
-            
+            [self handleRemoteAction:model];
         }
             break;
         case RADetailActionTypeLocal: {
@@ -172,6 +173,39 @@
     [self presentViewController:vc animated:YES completion:nil];
 }
 
+- (void)handleRemoteAction:(RADetailActionModel *)model {
+    
+    RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
+    
+    __weak typeof(self) weakSelf = self;
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        
+        NSDictionary *json = [RADataProvider reportAcionToURL:model.url withParams:model.params];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            
+            // dismiss progress
+            [hud dismiss];
+            
+            if (weakSelf) {
+                __strong typeof(weakSelf) strongSelf = weakSelf;
+                
+                int result = [[json objectForKey:@"result"] intValue];
+                if (result == RESULT_TRUE) {
+                    
+                    [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationReloadHome object:nil];
+                    [strongSelf.navigationController popViewControllerAnimated:YES];
+                    
+                } else {
+                    // process error
+                    
+                }
+            }
+            
+        });
+    });
+}
+
 #pragma mark - Popover Delegate
 
 -(UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller{
@@ -193,4 +227,27 @@
 
 }
 
+#pragma mark - Private
+
+- (void)instance:(id)obj playSEL:(SEL)selector parameters:(NSArray *)params {
+    if (!obj || !selector) {
+        return;
+    }
+    if ([obj respondsToSelector:selector]) {
+        NSMethodSignature *signature = [[obj class] instanceMethodSignatureForSelector:selector];
+        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
+        
+        [invocation setTarget:obj];
+        [invocation setSelector:selector];
+        if (params && params.count > 0) {
+            for (int i = 0; i < params.count; i++) {
+                NSObject *obj = params[i];
+                [invocation setArgument:&obj atIndex:i+2];
+            }
+            [invocation retainArguments]; // 防止参数被释放
+        }
+        [invocation invoke];
+    }
+}
+
 @end

+ 12 - 2
Redant Drivers/Apex And Drivers/FakeData/fake_order_detail.json

@@ -48,11 +48,21 @@
                             "actions": [
                                         {
                                         "actionType": "0",
-                                        "actionTitle": "Reject"
+                                        "actionTitle": "Reject",
+                                        "url": "",
+                                        "params": {
+                                        "action": "reject",
+                                        "orderID": "20180530001200"
+                                        }
                                         },
                                         {
                                         "actionType": "0",
-                                        "actionTitle": "Accept"
+                                        "actionTitle": "Accept",
+                                        "url": "",
+                                        "params": {
+                                        "action": "accept",
+                                        "orderID": "20180530001200"
+                                        }
                                         },
                                         {
                                         "actionType": "1",

+ 2 - 0
Redant Drivers/Apex And Drivers/Home/RAHomeViewController.h

@@ -13,6 +13,8 @@
 
 @property (strong, nonatomic) IBOutlet UITableView *homeOrderTableView;
 
+@property (nonatomic,copy) NSString *currentOrderID;
+
 #pragma mark - Getter
 
 - (NSUInteger)orderSectionCount;

+ 45 - 0
Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m

@@ -43,12 +43,26 @@
     return self.orders.count;
 }
 
+- (NSInteger)orderModelIndexForID:(NSString *)orderID {
+    
+    __block NSInteger curIndex = -1;;
+    [self.orders enumerateObjectsUsingBlock:^(RAHomeOrderModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
+        if ([obj.orderID isEqualToString:orderID]) {
+            curIndex = idx;
+            return ;
+        }
+    }];
+    return curIndex;
+}
+
 @end
 
+#pragma mark - View Controller
 
 @interface RAHomeViewController ()
 
 @property (nonatomic,strong) NSMutableArray <RAHomeSectionModel *> *sectionArray;
+@property (nonatomic,strong) NSIndexPath *currentIndexPath;
 
 @end
 
@@ -65,9 +79,18 @@
     
     [self configureNavigationBar];
     [self configureTable];
+    [self registNotification];
     [self loadData];
 }
 
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+}
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
@@ -86,6 +109,11 @@
     self.navigationItem.rightBarButtonItem = uploadListItem;
 }
 
+- (void)registNotification {
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNewOrderNotification:) name:RANotificationNewOrder object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNewOrderNotification:) name:RANotificationReloadHome object:nil];
+}
+
 #pragma mark - Action
 
 - (void)uploadListItemClick:(UIBarButtonItem *)sender {
@@ -134,6 +162,7 @@
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
        
         NSDictionary *json = [RADataProvider requestOrderList];
+        NSLog(@"home load data");
         
         dispatch_async(dispatch_get_main_queue(), ^{
             
@@ -153,6 +182,12 @@
                         RAHomeSectionModel *sectionModel = [RAHomeSectionModel new];
                         [sectionModel setValuesForKeysWithDictionary:section];
                         [strongSelf.sectionArray addObject:sectionModel];
+                        if (self.currentOrderID.length > 0) {
+                            NSInteger idx = [sectionModel orderModelIndexForID:self.currentOrderID];
+                            if (idx > -1) {
+                                self.currentIndexPath = [NSIndexPath indexPathForRow:idx inSection:i];
+                            }
+                        }
                     }
 
                     [strongSelf.homeOrderTableView reloadData];
@@ -177,4 +212,14 @@
     [self.navigationController pushViewController:detailVC animated:YES];
 }
 
+#pragma mark - Nofitication Selector
+
+- (void)receiveNewOrderNotification:(NSNotification *)notification {
+    [self loadData];
+}
+
+- (void)receiveReloadNotification:(NSNotification *)notification {
+    [self loadData];
+}
+
 @end

+ 1 - 0
Redant Drivers/Apex And Drivers/PrefixHeader.pch

@@ -20,6 +20,7 @@
 #import "RADataProvider.h"
 #import "RASingleton.h"
 #import "RAUtils.h"
+#import "RANotificationNameCenter.h"
 
 
 #endif

+ 2 - 0
Redant Drivers/Apex And Drivers/RADataProvider.h

@@ -20,4 +20,6 @@
 
 + (NSDictionary *)requestUpdateOrder:(NSString *)orderID driverAction:(NSInteger)action;
 
++ (NSDictionary *)reportAcionToURL:(NSString *)url withParams:(NSMutableDictionary *)params;
+
 @end

+ 13 - 0
Redant Drivers/Apex And Drivers/RADataProvider.m

@@ -169,6 +169,7 @@
 
 + (NSDictionary *)requestOrderList {
     
+    sleep(3.0);
     return [self loadFakeData:@"fake_order_list.json"];
     
     
@@ -184,6 +185,7 @@
 
 + (NSDictionary *)requestOrderDetail:(NSString *)orderID {
     
+    sleep(3.0);
     return [self loadFakeData:@"fake_order_detail.json"];
     
     NSMutableDictionary *params = [NSMutableDictionary dictionary];
@@ -198,6 +200,7 @@
 
 + (NSDictionary *)requestUpdateOrder:(NSString *)orderID driverAction:(NSInteger)action {
     
+    sleep(3.0);
     return [self loadFakeData:@"fake_order_edit.json"];
     
     NSMutableDictionary *params = [NSMutableDictionary dictionary];
@@ -210,6 +213,16 @@
     return [self handleJsonData:json];
 }
 
++ (NSDictionary *)reportAcionToURL:(NSString *)url withParams:(NSMutableDictionary *)params {
+    
+    sleep(3.0);
+    return @{@"result" : @2};
+    
+    NSData* json=[self get_json:url parameters:params  file:nil];
+    
+    return [self handleJsonData:json];
+}
+
 + (NSDictionary *)loadFakeData:(NSString *)fileName {
     
     NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:nil];

+ 13 - 0
Redant Drivers/Apex And Drivers/RANotificationNameCenter.h

@@ -0,0 +1,13 @@
+//
+//  RANotificationNameCenter.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/7.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+FOUNDATION_EXTERN NSString * const RANotificationNewOrder;
+FOUNDATION_EXTERN NSString * const RANotificationReloadHome;

+ 14 - 0
Redant Drivers/Apex And Drivers/RANotificationNameCenter.m

@@ -0,0 +1,14 @@
+//
+//  RANotificationNameCenter.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/6/7.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RANotificationNameCenter.h"
+
+
+NSString * const RANotificationNewOrder     = @"RANotificationNewOrder";
+NSString * const RANotificationReloadHome   = @"RANotificationReloadHome";
+

+ 2 - 0
Redant Drivers/Apex And Drivers/RAProgressHUD.m

@@ -72,6 +72,8 @@ static const CGFloat HUDSIZE = 100.0f;
                                                                constant:HUDSIZE];
     [view addConstraints:@[h_center,v_center,width,height]];
     
+    hud.title = title;
+    
     hud.indicatorLabel.frame = CGRectMake(0, 70, HUDSIZE, 20);
     [hud addSubview:hud.indicatorLabel];
     

+ 3 - 3
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m

@@ -17,7 +17,7 @@
 #import "ZipArchive.h"
 #import "AppDelegate.h"
 
-#import <MapKit/MapKit.h>
+#import <CoreLocation/CoreLocation.h>
 
 @interface RAEditSectionModel : NSObject
 
@@ -140,10 +140,9 @@
 - (void)startLocation {
     self.locationManager = [[CLLocationManager alloc] init];
     self.locationManager.delegate = self;
+    self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;//设置定位精度
     [self.locationManager requestWhenInUseAuthorization];
     [self.locationManager startUpdatingLocation];
-    self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;//设置定位精度
-    self.locationManager.distanceFilter = 10;
 }
 
 - (void)stopLocation {
@@ -270,6 +269,7 @@
         
         UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
             
+            [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationReloadHome object:nil];
             [weakSelf.navigationController popToRootViewControllerAnimated:YES];
         }];