apple 5 жил өмнө
parent
commit
f378d6243e

BIN
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate


+ 28 - 3
ios/JianYuIOS/JianYuIOS/AppDelegate.m

@@ -19,7 +19,7 @@
 
 #import "JYTabBarController.h"
 #import "ZKGuideView.h"
-
+#import "NSURLProtocolCustom.h"
 @interface AppDelegate ()<JPUSHRegisterDelegate,WXApiDelegate,UNUserNotificationCenterDelegate>
 
 @property(nonatomic, strong)UIImageView *imgView;
@@ -33,10 +33,18 @@
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     // Override point for customization after application launch.
 
+
+//    [self initNSURLProtocol];//注册拦截协议
+    
+    
     self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
     JYTabBarController *tabBarVc = [[JYTabBarController alloc] init];
     self.window.rootViewController = tabBarVc;
     [self.window makeKeyAndVisible];
+
+//    NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
+//
+//    [NSURLCache setSharedURLCache:URLCache];
     
     NSString *isProvacy = [[NSUserDefaults standardUserDefaults] objectForKey:@"FirstPrivacy"];
     if ([isProvacy isEqualToString:@"1"]) {
@@ -48,10 +56,10 @@
     }
 
     NSLog(@"初始化");
-    [GlobalData shareInstance];
+    NSLog(@"%@",[[GlobalData shareInstance] getDocumentPath]);
+    NSLog(@"%@",[[GlobalData shareInstance] getfsCachedData]);
     [LXDataBaseManager shareDataBaseManager];//初始化单例
     [LXViewControllerManager shareViewControllerManager];
-    
     [self initJPush:launchOptions];
 //    [self initUM];
     [self registeredPush]; //注册原生推送
@@ -76,6 +84,23 @@
     return YES;
 }
 
+-(void)initNSURLProtocol {
+    //注册
+    [NSURLProtocol registerClass:[NSURLProtocolCustom class]];
+    //实现拦截功能
+    Class cls = NSClassFromString(@"WKBrowsingContextController");
+    SEL sel = NSSelectorFromString(@"registerSchemeForCustomProtocol:");
+    if([(id)cls respondsToSelector:sel]) {
+    #pragma clang diagnostic push
+
+    #pragma clang diagnostic ignored"-Warc-performSelector-leaks"
+//        [(id)cls performSelector:sel withObject:@"http"];
+//        [(id)cls performSelector:sel withObject:@"https"];
+        [(id)cls performSelector:sel withObject:@"res"];
+    #pragma clang diagnostic pop
+
+    }
+}
 
 -(void)initJPush:(NSDictionary *)launchOptions{
     JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];

+ 61 - 4
ios/JianYuIOS/JianYuIOS/BaseClass1/GlobalData.h

@@ -17,9 +17,66 @@
 @property (nonatomic,assign)BOOL isReLogin;//是否重新登录
 
 
-//@property (nonatomic,assign)BOOL isPayShowTabSearch;
-//@property (nonatomic,assign)BOOL isPayShowTabSub;
-//@property (nonatomic,assign)BOOL isPayShowTabExp;
-//@property (nonatomic,assign)BOOL isPayShowTabMine;
+//Plist 表相关
+
+//创建plist
+-(BOOL)createPlist;
+//获取所有数据
+-(NSMutableDictionary *)getPlistAllData;
+//获取数量
+-(NSInteger)getPlistCount;
+//清空数据
+-(void)clearPlistData;
+//添加一条数据
+-(void)addOnePlistData:(NSDictionary *)dict;
+
+
+
+
+//返回缓存根目录 "caches"
+-(NSString *)getCachesDirectory;
+
+//返回根目录路径 "document"
+-(NSString *)getDocumentPath;
+
+//返回WK的缓存目录
+-(NSString *)getfsCachedData;
+
+
+
+
+//创建文件夹
+-(BOOL)creatDir:(NSString*)dirPath;
+//
+//删除文件夹
+-(BOOL)deleteDir:(NSString*)dirPath;
+
+//移动文件夹
+-(BOOL)moveDir:(NSString *)srcPath to:(NSString *)desPath;
+
+//创建文件
+-(BOOL)creatFile:(NSString *)filePath withData:(NSData *)data;
+
+//读取文件
+-(NSData*)readFile:(NSString *)filePath;
+
+//删除文件
+-(BOOL)deleteFile:(NSString *)filePath;
+
+//返回 文件全路径
+-(NSString *)getFilePath:(NSString *) fileName;
+
+//在对应文件保存数据
+-(BOOL)writeDataToFile:(NSString *)fileName data:(NSData *)data;
+
+//从对应的文件读取数据
+-(NSData *)readDataFromFile:(NSString *)fileName;
+
+
+
+
+
+
+
 
 @end

+ 192 - 0
ios/JianYuIOS/JianYuIOS/BaseClass1/GlobalData.m

@@ -48,5 +48,197 @@
     self.isReLogin = NO;
     
 }
+//创建plist
+-(BOOL)createPlist {
+    
+    return NO;
+}
+
+//获取plist所有数据
+-(NSMutableDictionary *)getPlistAllData {
+    //获取路径
+    NSArray *sandboxpath= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *filePath = [[sandboxpath objectAtIndex:0] stringByAppendingPathComponent:@"sandbox.plist"];
+    NSLog(@"%@",NSHomeDirectory());
+    //获取数据
+    NSMutableDictionary *searchdata = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
+    NSLog(@"%@",searchdata);
+    return searchdata;
+}
+//获取plist数量
+-(NSInteger)getPlistCount {
+    NSMutableDictionary *dict = [self getPlistAllData];
+    return [dict[@"error"] count];
+}
+//删除plist表
+-(void)clearPlistData {
+    NSFileManager *manager=[NSFileManager defaultManager];
+    //文件路径
+    NSString *filepath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0]stringByAppendingPathComponent:@"sandbox.plist"];
+    if ([manager removeItemAtPath:filepath error:nil]) {
+        NSLog(@"文件删除成功");
+    }
+}
+
+-(void)addOnePlistData:(NSDictionary *)dict {
+    //先判断是否存在
+    NSArray *sandboxpath= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    //获取完整路径
+    NSString *documentsDirectory = [sandboxpath objectAtIndex:0];
+    NSString *plistPath = [documentsDirectory stringByAppendingPathComponent:@"sandbox.plist"];
+    //存储根数据
+    NSMutableDictionary *rootDic = [[NSMutableDictionary alloc ] init];
+    //字典中的详细数据
+    NSMutableDictionary *userDataDic = [[NSMutableDictionary alloc]init];
+    [userDataDic setObject:@"Flephant" forKey:@"UserName"];
+    [userDataDic setObject:@"http://www.cnblogs.com/xiaofeixiang/" forKey:@"UserPassWord"];
+     
+    [rootDic setObject:userDataDic forKey:@"Login"];
+    //写入文件
+    [rootDic writeToFile:plistPath atomically:YES];
+    NSLog(@"%@",NSHomeDirectory());
+    NSLog(@"写入成功");
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#pragma mark  ****缓存目录相关
+
+
+
+
+
+
+
+
+
+
+
+//返回缓存根目录 "caches"
+-(NSString *)getCachesDirectory
+{
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *caches = [paths firstObject];
+    return caches;
+}
+
+//返回根目录路径 "document"
+
+-(NSString *)getDocumentPath
+{
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *documentPath = [paths firstObject];
+    return documentPath;
+}
+
+-(NSString *)getfsCachedData {
+    NSString *libraryDir = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
+    NSUserDomainMask, YES)[0];
+    NSString *bundleId  =  [[[NSBundle mainBundle] infoDictionary]
+    objectForKey:@"CFBundleIdentifier"];
+    NSString *webkitFolderInLib = [NSString stringWithFormat:@"%@/WebKit",libraryDir];
+    NSString *webKitFolderInCaches = [NSString
+    stringWithFormat:@"%@/Caches/%@/WebKit",libraryDir,bundleId];
+     NSString *webKitFolderInCachesfs = [NSString
+     stringWithFormat:@"%@/Caches/%@/fsCachedData",libraryDir,bundleId];
+    return webKitFolderInCachesfs;
+
+    //    NSError *error;
+    //    /* iOS8.0 WebView Cache的存放路径 */
+    //    [[NSFileManager defaultManager] removeItemAtPath:webKitFolderInCaches error:&error];
+    //    [[NSFileManager defaultManager] removeItemAtPath:webkitFolderInLib error:nil];
+    //
+    //    /* iOS7.0 WebView Cache的存放路径 */
+    //    [[NSFileManager defaultManager] removeItemAtPath:webKitFolderInCachesfs error:&error];
+}
+
+
+//创建文件目录
+-(BOOL)creatDir:(NSString*)dirPath
+{
+    if ([[NSFileManager defaultManager] fileExistsAtPath:dirPath])//判断dirPath路径文件夹是否已存在,此处dirPath为需要新建的文件夹的绝对路径
+    {
+        return NO;
+    }
+    else
+    {
+        [[NSFileManager defaultManager] createDirectoryAtPath:dirPath withIntermediateDirectories:YES attributes:nil error:nil];//创建文件夹
+        return YES;
+    }
+
+}
+
+
+
+-(BOOL)deleteDir:(NSString*)dirPath
+{
+    if([[NSFileManager defaultManager] fileExistsAtPath:dirPath]) {
+        NSError *error=nil;
+        return [[NSFileManager defaultManager]  removeItemAtPath:dirPath error:&error];
+    }
+    return  NO;
+    //如果存在临时文件的配置文件
+}
+
+
+//移动文件夹
+-(BOOL)moveDir:(NSString*)srcPath to:(NSString*)desPath {
+    NSError *error=nil;
+    if([[NSFileManager defaultManager] moveItemAtPath:srcPath toPath:desPath error:&error]!=YES)// prePath 为原路径、 cenPath 为目标路径
+    {
+        NSLog(@"移动文件失败");
+        return NO;
+    }else{
+        NSLog(@"移动文件成功");
+        return YES;
+    }
+}
+
+//创建文件
+
+-(BOOL)creatFile:(NSString*)filePath withData:(NSData*)data
+{
+    return [[NSFileManager defaultManager] createFileAtPath:filePath contents:data attributes:nil];
+}
+
+//读取文件
+-(NSData*)readFile:(NSString *)filePath
+{
+    return [NSData dataWithContentsOfFile:filePath options:0 error:NULL];
+}
+
+//删除文件
+-(BOOL)deleteFile:(NSString *)filePath {
+    return [self deleteDir:filePath];
+}
+
+-(NSString *)getFilePath:(NSString *)fileName
+{
+    NSString *dirPath = [[self getDocumentPath] stringByAppendingPathComponent:fileName];
+    return dirPath;
+}
+-(BOOL)writeDataToFile:(NSString *)fileName data:(NSData *)data
+{
+    NSString *filePath=[self getFilePath:fileName];
+    return [self creatFile:filePath withData:data];
+}
+
+-(NSData*)readDataFromFile:(NSString*)fileName
+{
+    NSString *filePath=[self getFilePath:fileName];
+    return [self readFile:filePath];
+}
+
 
 @end

+ 111 - 53
ios/JianYuIOS/JianYuIOS/BaseClass1/NSURLProtocolCustom.m

@@ -1,81 +1,139 @@
 //
 //  NSURLProtocolCustom.m
-//  JianYuIOS
 //
-//  Created by apple on 2020/6/9.
-//  Copyright © 2020 lixianglan. All rights reserved.
+//  Created by shuoyu liu on 2017/1/16.
+//  Copyright © 2017年 shuoyu liu. All rights reserved.
 //
 
 #import "NSURLProtocolCustom.h"
+#import <UIKit/UIKit.h>
+#import "LXMD5.h"
 
+static NSString* const protocolKey = @"protocolKey";
+@interface NSURLProtocolCustom ()<NSURLSessionDelegate>
+@property (nonnull,strong) NSURLSessionDataTask *task;
 
-static NSString* const FilteredKey = @"FilteredKey";
+@end
 
-@implementation NSURLProtocolCustom
 
-+ (BOOL)canInitWithRequest:(NSURLRequest *)request
-{
-    NSString *extension = request.URL.pathExtension;
-    
-    BOOL isSource = [@[@"png", @"jpeg", @"gif", @"jpg", @"js", @"css"] indexOfObjectPassingTest:^BOOL(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-        return [extension compare:obj options:NSCaseInsensitiveSearch] == NSOrderedSame;
-    }] != NSNotFound;
+@implementation NSURLProtocolCustom
 
-    NSLog(@"检测监测监测:%@---%@",extension,[NSURLProtocol propertyForKey:FilteredKey inRequest:request]);
-    return [NSURLProtocol propertyForKey:FilteredKey inRequest:request] == nil && isSource;
-}
- 
-+ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request
-{
-    return request;
++ (BOOL)canInitWithRequest:(NSURLRequest *)request {
+    if ([NSURLProtocol propertyForKey:protocolKey inRequest:request]) {
+        return NO;
+    }
+    NSString * url = request.URL.absoluteString;
+    if ([url hasPrefix:@"res://"]) {
+        NSLog(@"协议拦截成功:%@",url);
+        return YES;
+    }
+    return NO;
 }
 
 
++ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request {
+
+    NSMutableURLRequest *mutableReqeust = [request mutableCopy];
+    if ([mutableReqeust.URL host].length == 0) {
+        return mutableReqeust;
+    }
+    NSString *curStr = [mutableReqeust.URL absoluteString];
+    // 替换域名
+    NSString *urlString = [curStr stringByReplacingOccurrencesOfString:@"res://" withString:@"http://"];
+    NSURL *urlll = [NSURL URLWithString:urlString];
+    mutableReqeust.URL = urlll;
+    return mutableReqeust;
+}
+    
 - (void)startLoading
 {
-    NSString *fileName = [super.request.URL.absoluteString componentsSeparatedByString:@"/"].lastObject;
-    NSLog(@"fileName is %@",fileName);
-    //这里是获取本地资源路径 如:png,js等
-    NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:nil];
-    if (!path) {
-        [self sendResponseWithData:[NSData data] mimeType:nil];
-        return;
+    //判断是否包含版本--
+    NSString *curUrl = [NSString stringWithFormat:@"%@",self.request.URL.absoluteString];
+    if ([curUrl containsString:@"?v="]) {
+        NSString *verName = @"";
+        NSLog(@"有相关版本号url:%@",curUrl);
+        verName =[curUrl componentsSeparatedByString:@"?v="].lastObject;
+        NSLog(@"版本目录名:%@",verName);
+        //查询缓存目录
+        NSString *pathName = [NSString stringWithFormat:@"%@/%@",[[GlobalData shareInstance]getDocumentPath],verName];
+         //如果无则创建否则
+        if (![[GlobalData shareInstance] creatDir:pathName]) {
+            NSLog(@"文件夹已存在");
+        }else {
+            NSLog(@"文件夹不存在,创建");
+        }
+        NSString *filePath = [NSString stringWithFormat:@"%@/%@",pathName,[LXMD5 md532BitLower:curUrl]];
+        NSData *fileData = [[GlobalData shareInstance] readFile:filePath];
+        if (fileData!=nil) {//存在查询数据
+            NSLog(@"沙盒有数据");
+            NSURLResponse* response = [[NSURLResponse alloc] initWithURL:self.request.URL MIMEType:nil expectedContentLength:fileData.length textEncodingName:nil];
+            [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
+            [self.client URLProtocol:self didLoadData:fileData];
+            [self.client URLProtocolDidFinishLoading:self];
+        }else {
+            //沙盒添加数据
+            NSLog(@"沙盒无数据");
+            NSData *data = [NSData dataWithContentsOfURL:self.request.URL];
+            [[GlobalData shareInstance] creatFile:filePath withData:data];
+        
+            
+            NSData *curData = [[GlobalData shareInstance] readFile:filePath];
+            
+            
+            NSURLResponse* response = [[NSURLResponse alloc] initWithURL:self.request.URL MIMEType:nil expectedContentLength:curData.length textEncodingName:nil];
+            [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
+            [self.client URLProtocol:self didLoadData:curData];
+            [self.client URLProtocolDidFinishLoading:self];
+        }
+        
+        
+        
+        
+    }else {
+        //查询项目目录
+        NSString *fileName = [super.request.URL.absoluteString componentsSeparatedByString:@"/"].lastObject;
+        NSLog(@"无V当前fileName:%@",fileName);
+        NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:nil];
+        if (path) {
+            NSLog(@"项目目录有数据");
+            NSData *data = [NSData dataWithContentsOfFile:path];
+            NSURLResponse* response = [[NSURLResponse alloc] initWithURL:self.request.URL MIMEType:nil expectedContentLength:data.length textEncodingName:nil];
+            [self.client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageAllowed];
+            [self.client URLProtocol:self didLoadData:data];
+            [self.client URLProtocolDidFinishLoading:self];
+        }else {
+            NSLog(@"项目目录本地无数据");
+            NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:nil];
+            self.task = [session dataTaskWithRequest:self.request];
+            [self.task resume];
+        }
     }
     
-    //根据路径获取MIMEType
-    CFStringRef pathExtension = (__bridge_retained CFStringRef)[path pathExtension];
-    CFStringRef type = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension, NULL);
-    CFRelease(pathExtension);
     
-    //The UTI can be converted to a mime type:
-    NSString *mimeType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass(type, kUTTagClassMIMEType);
-    if (type != NULL)
-        CFRelease(type);
     
-    //加载本地资源
-    NSData *data = [NSData dataWithContentsOfFile:path];
-    [self sendResponseWithData:data mimeType:mimeType];
+    
+    
+    
+    
 }
-
-- (void)stopLoading
-{
-    NSLog(@"stopLoading, something went wrong!");
+- (void)stopLoading {
+    if (self.task != nil) {
+        [self.task cancel];
+    }
 }
- 
-- (void)sendResponseWithData:(NSData *)data mimeType:(nullable NSString *)mimeType
-{
-    // 这里需要用到MIMEType
-    NSURLResponse *response = [[NSURLResponse alloc] initWithURL:super.request.URL
-                                                        MIMEType:mimeType
-                                           expectedContentLength:-1
-                                                textEncodingName:nil];
+
+- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler {
+    [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageAllowed];
     
-    //硬编码 开始嵌入本地资源到web中
-    [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
-    [[self client] URLProtocol:self didLoadData:data];
-    [[self client] URLProtocolDidFinishLoading:self];
+    completionHandler(NSURLSessionResponseAllow);
+}
 
+- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {
+    [[self client] URLProtocol:self didLoadData:data];
 }
 
+- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(nullable NSError *)error {
+    [self.client URLProtocolDidFinishLoading:self];
+}
 
 @end

+ 28 - 2
ios/JianYuIOS/JianYuIOS/BaseClass1/PrefixHeader.pch

@@ -16,8 +16,6 @@
 #import "LXNetworkManager.h"
 #import "AppDelegate.h"
 #import "UITabBar+badge.h"
-
-
 //屏幕宽
 #define WIDTH [UIScreen mainScreen].bounds.size.width
 //屏幕高
@@ -172,6 +170,34 @@ _Pragma("clang diagnostic pop")\
  18613717801    123456
  */
 
+
+#define POST_JS @"function my_post(path, params) {\
+var method = \"POST\";\
+var form = document.createElement(\"form\");\
+form.setAttribute(\"method\", method);\
+form.setAttribute(\"action\", path);\
+for(var key in params){\
+    if (params.hasOwnProperty(key)) {\
+        var hiddenFild = document.createElement(\"input\");\
+        hiddenFild.setAttribute(\"type\", \"hidden\");\
+        hiddenFild.setAttribute(\"name\", key);\
+        hiddenFild.setAttribute(\"value\", params[key]);\
+    }\
+    form.appendChild(hiddenFild);\
+}\
+document.body.appendChild(form);\
+form.submit();\
+}"
+
+
+
+
+
+
+
+
+
+
 #endif /* PrefixHeader_pch */
 
 

+ 5 - 8
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSearchViewController.m

@@ -126,6 +126,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     if ([LXUserDefaults isExistToken]) {
         url = [url stringByAppendingString:[NSString stringWithFormat:@"?sign=%@&url=/jyapp/jylab/mainSearch&from=restart", token]];
     }
+//    url = @"http://web-jydev-zyh.jianyu360.cn/jyapp/jylab/mainSearch";
     NSLog(@"111 :第一次加载:%@",url);
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     
@@ -310,7 +311,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     NSError *err = nil;
     NSData *dataFromString = [prompt dataUsingEncoding:NSUTF8StringEncoding];
     NSDictionary *paramdict = [NSJSONSerialization JSONObjectWithData:dataFromString options:NSJSONReadingMutableContainers error:&err];
-    NSLog(@"拦截prompt:%@",paramdict);
+//    NSLog(@"拦截prompt:%@",paramdict);
     if (!err){
         NSString *type = [paramdict objectForKey:@"jsName"];
         if (type && [type isEqualToString:@"getUserToken"]) {
@@ -424,7 +425,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     });
 }
 -(void)executeCallJS:(NSString *)jsStr {
-    
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
         NSLog(@"OC调JS交互%@:",jsStr);
         [_webView evaluateJavaScript:jsStr completionHandler:^(id _Nullable result, NSError * _Nullable error) {
@@ -434,7 +434,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
             }
         }];
     });
-
 }
 
 -(void)initNSURLProtocol {
@@ -450,6 +449,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
         [(id)cls performSelector:sel withObject:@"https"];
     #pragma clang diagnostic pop
     }
+    
 }
 
 - (void)viewDidLoad {
@@ -457,9 +457,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     // Do any additional setup after loading the view.
     NSLog(@"首页初始化");
     self.view.backgroundColor = [UIColor whiteColor];
-    
-    [self initNSURLProtocol];
-    
+
     [self.view addSubview:self.webView];
     [self.view addSubview:self.progressView];
     [self webViewFirstRequest];
@@ -551,7 +549,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     }
 
     [self removeNoNetViews];
-    
     [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
 
 }
@@ -876,7 +873,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     return device.platformString;
 }
 -(NSString *)jsGetLocation:(NSDictionary *)dict {
-    NSLog(@"------开始调用获取位置:%@",self.placeAdr);
+//    NSLog(@"------开始调用获取位置:%@",self.placeAdr);
     if (!self.isLocation) {
         // 1.检查定位服务是否开启
         if ([self checkLocationServiceIsEnabled]) {

+ 7 - 0
ios/JianYuIOS/JianYuIOS/Info.plist

@@ -109,6 +109,13 @@
 				<key>NSIncludesSubdomains</key>
 				<true/>
 			</dict>
+			<key>web-jydev-zyh.jianyu360.cn</key>
+			<dict>
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
+				<true/>
+				<key>NSIncludesSubdomains</key>
+				<true/>
+			</dict>
 		</dict>
 	</dict>
 	<key>NSCameraUsageDescription</key>

+ 14 - 1
ios/JianYuIOS/JianYuIOS/JYTabBarController.m

@@ -83,8 +83,21 @@
 //    if(tabBarController.tabBar.selectedItem.tag==0) {
 //        return NO;
 //    }
+    
+    if(tabBarController.tabBar.selectedItem.tag==0) {
+        //创建
+        [[GlobalData shareInstance] getPlistAllData];
+    }else if (tabBarController.tabBar.selectedItem.tag==1) {
+        [[GlobalData shareInstance] getPlistCount];
+    }else if (tabBarController.tabBar.selectedItem.tag==2) {
+        [[GlobalData shareInstance] addOnePlistData:@{@"cc":@"11"}];
+    } else {
+        [[GlobalData shareInstance] clearPlistData];
+    }
+
+    return NO;
     if (![LXUserDefaults isExistToken]) {
-        
+    
         if(tabBarController.tabBar.selectedItem.tag!=0) {
             NSLog(@"没有token前往登录");
             NSString *index = [NSString stringWithFormat:@"%ld",tabBarController.tabBar.selectedItem.tag];