BuglyDevTeam / BuglyHotfix-iOS

iOS library for Bugly App Hot fix Service
7 stars 0 forks source link

iOS14 检测到有脚本,但是无法加载成功,13正常 #3

Open fateshen opened 4 years ago

fateshen commented 4 years ago

//检测补丁策略 [[BuglyMender sharedMender] checkRemoteConfigWithEventHandler:^(BuglyHotfixEvent event, NSDictionary patchInfo) { //有新补丁或本地补丁状态正常 if (event == BuglyHotfixEventPatchValid || event == BuglyHotfixEventNewPatch) { //获取本地补丁路径 NSString patchDirectory = [[BuglyMender sharedMender] patchDirectory]; if (patchDirectory) { //指定执行的 js 脚本文件名 NSString patchFileName = @"main.js"; NSString patchFile = [patchDirectory stringByAppendingPathComponent:patchFileName]; //执行补丁加载并上报激活状态 if ([[NSFileManager defaultManager] fileExistsAtPath:patchFile] && [JPEngine evaluateScriptWithPath:patchFile] != nil) {

                NSData* data = [[NSData alloc] init];
                data = [[NSFileManager defaultManager] contentsAtPath:patchFile];
                NSLog(@"main.js = %@",[[NSString alloc] initWithData:[[NSFileManager defaultManager] contentsAtPath:patchFile] encoding:NSUTF8StringEncoding]);

                BLYLogInfo(@"evaluateScript success");
                [[BuglyMender sharedMender] reportPatchStatus:BuglyHotfixPatchStatusActiveSucess];
            }else {
                BLYLogInfo(@"evaluateScript failed");
                [[BuglyMender sharedMender] reportPatchStatus:BuglyHotfixPatchStatusActiveFail];
            }
        }
    }
}];

/* patchDirectory 正常,[[NSFileManager defaultManager] fileExistsAtPath:patchDirectory]返回YES patchFile 不存在,[[NSFileManager defaultManager] fileExistsAtPath:patchFile]返回NO [JPEngine evaluateScriptWithPath:patchFile]报错: container_create_or_lookup_path_for_platform: client is not entitled container_create_or_lookup_app_group_path_by_app_group_identifier: client is not entitled 大致可能就是main.js没有下载成功,在iOS14上, 13是正常的, 在14上换用JSPatch下发补丁是可以执行的 /

fateshen commented 4 years ago

我写的代码在iOS14上不兼容,需要修改,已经写好脚本,通过 [JSPatch testScriptInBundle]测试成功,下发后,iOS14版本机器上永远不执行,卸载重装,重启都多次尝试,iOS13的机器稳定执行。。。。关键是我补丁就是修改在iOS14上的兼容问题,还就14不执行。。。好心累。

fateshen commented 4 years ago

控制台打印 [Bugly][Info] Bugly (Hotfix) [2.5.0.1(2.1.0)] started [Bugly][Info] Report analytics data successed [Bugly][Info] Hotfix: update patch [Bugly][Info] Hotfix: fetch remote patch info successed

waydelau commented 3 years ago

我也遇到这个问题,请问有解决吗