配置Apple Universal Links

配置网站 创建 apple-app-site-association 在网站根目录或者 .well-known目录下创建 apple-app-site-association 文件。注意,文件没有后缀名。 文件是一个json文件,内容如下: { "applinks": { "apps": [], "details": [ { "appID": "团队ID.应用BundleID" "paths": ["/路径/*"] } ] } } 团队ID,和应用签名证书上的TeamId保存一致 路径 ,遵循url对应的规范,建议每一个App应用都使用独立的路径,便于管理 配置MIME 因为apple-app-site-association 的数据格式是json,所有对应MIME类型:application/json。 在对应的站点配置文件里设置,以nginx为例: # 如果文件在根目录 location /apple-app-site-association { default_type application/json; } # 如果文件在.well-known目录 location /.well-known/apple-app-site-association { default_type application/json; } 验证网站配置 打开 https://branch.io/resources/aasa-validator/ , 输入网站域名并验证配置是否正确。 关于缓存 Apple会缓存apple-app-site-association文件内容,缓存未必及时更新(一般不超过48小时),所以有时候通过Universal Links打开App会失败。 打开 https://app-site-association.cdn-apple.com/a/v1/你的网站域名可以查看缓存内容 创建 Universal Links网页 还需要在网站部署一个 Universal Links网页。网页的访问路径需要和apple-app-site-association文件中配置的路径一致。 当使用 Safari 浏览器打开Universal Links网页时,可唤起App。 ...

May 21, 2026 · 2 min · holdsky

Xcode调试iPhone真机 :code signature version is no longer supported

Details Unable to install "MyApp" Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402620375 - The code signature version is no longer supported. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402620375 User Info: { DVTRadarComponentKey = 261622; MobileDeviceErrorCode = "(0xE8008029)"; "com.apple.dtdevicekit.stacktrace" = ( 0 DTDeviceKitBase 0x000000011edd83b8 DTDKCreateNSErrorFromAMDErrorCode + 220 1 DTDeviceKitBase 0x000000011ee16ae1 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155 2 DVTFoundation 0x0000000107881b7c DVTInvokeWithStrongOwnership + 71 3 DTDeviceKitBase 0x000000011ee16822 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440 4 IDEiOSSupportCore 0x000000011eccf999 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.294 + 3534 5 DVTFoundation 0x00000001079b4931 __DVT_CALLING_CLIENT_BLOCK__ + 7 6 DVTFoundation 0x00000001079b655b __DVTDispatchAsync_block_invoke + 1191 7 libdispatch.dylib 0x00007fff20508603 _dispatch_call_block_and_release + 12 8 libdispatch.dylib 0x00007fff205097e6 _dispatch_client_callout + 8 9 libdispatch.dylib 0x00007fff2050f5ca _dispatch_lane_serial_drain + 606 10 libdispatch.dylib 0x00007fff2051008d _dispatch_lane_invoke + 366 11 libdispatch.dylib 0x00007fff20519bed _dispatch_workloop_worker_thread + 811 12 libsystem_pthread.dylib 0x00007fff206b04c0 _pthread_wqthread + 314 13 libsystem_pthread.dylib 0x00007fff206af493 start_wqthread + 15 ); } - 可能是因为对framework的签名不一致导致,有的是 Do Not Embed, 有的是 Embed and Sign ...

July 30, 2021 · 1 min · holdsky

iOS 诡异的崩溃EXC_BREAKPOINT (code=1, subcode=0x1c5691d2c)

系统 : iOS 13.3.1 机型: iPhone7 dispatch_async(_jsContextQueue, ^{ JSContext *jscontent = [[JSContext alloc] init]; [UIWebView class]; }); 看代码,按照正常思维理解, [UIWebView class]是无论如何都不应崩溃的。 起初按照惯性思维去查找僵尸变量,忙活了半天没有定位。 最终定位结果如下: 在没有调用过UIWebView的任何函数时,先在非主线程调用UIWebView方法,则会导致崩溃 本文的相关代码如下 #import "ViewController.h" #import <JavaScriptCore/JavaScriptCore.h> @interface ViewController ()<UITableViewDelegate,UITableViewDataSource> { dispatch_queue_t _jsContextQueue; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; _jsContextQueue = dispatch_queue_create("jscontext", NULL); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_async(_jsContextQueue, ^{ JSContext *jscontent = [[JSContext alloc] init]; [UIWebView class]; }); }); } @end

March 10, 2020 · 1 min · holdsky

WKWebView : html的input控件的onfocus事件被触发了两次

环境: iOS 13.2 + WKWebView 现象一: 当不添加 viewport 时,onfocus被触发一次 <!DOCTYPE html> <html> <head> <script> function onfocus123(e){ console.log(456); } </script> </head> <body> <span>test_input</span> <input id="test_input" type="text" onfocus="onfocus123(event)"> </body> </html> 第一次点击input输入框第二次点击input输入框输出:456输出: 456 现象一: 当添加 viewport 时,onfocus被触发两次 <!DOCTYPE html> <html> <head> <script> function onfocus123(e){ console.log(456); } </script> <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover,user-scalable=no"> </head> <body> <span>test_input</span> <input id="test_input" type="text" onfocus="onfocus123(event)"> </body> </html> 第一次点击input输入框第二次点击input输入框输出:456 456输出: 456 ...

February 11, 2020 · 1 min · holdsky

Objective-C:动态创建新类(Class)

动态创建一个类,NewClass ,继承自NSObject Class newClass = objc_allocateClassPair([NSObject class], "NewClass", 0); //向运行时注册这个类 objc_registerClassPair(newClass); //从运行时销毁这个类 objc_disposeClassPair(newClass);

November 29, 2019 · 1 min · holdsky

Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

接手一个项目,Debug运行后打开WKWebView的页面,Xcode报出日志 Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 解决办法: 在WKWebView在Window上显示之前,不要加载网页 直白的代码如下: [self.view addSubView:wkwebView]; [wkwebView loadRequest:request]

November 7, 2019 · 1 min · holdsky

WKWebView:适配H5页面的显示尺寸

一般的同样的html代码,在UIWebView和WKWebView中显示效果是不一样的。例如 <!DOCTYPE html> <html> <body> <span>test_input</span> <input id="test_input" type="text"> </body> </html> 显示效果: 可以看出两者有明显的区别。 那么如何适配呢?有两个方法(本质上是一个)。 1、如果是H5适配WKWebView的话,需要在H5添加如下代码 <meta name="viewport" content="width=device-width"> 完整的html如下 <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width"> </head> <body> <span>test_input</span> <input id="test_input" type="text"> </body> </html> 2、如果是WKWebView适配H5的话,那么就需要替前端添加相同的H5代码,实现如下 //js代码,在文档加载完毕后,添加head的子节点 //节点内容为<meta name="viewport" content="width=device-width"> let jScript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);"; let wkUScript = WKUserScript.init(source: jScript, injectionTime: WKUserScriptInjectionTime.atDocumentEnd, forMainFrameOnly: true); let wkUController = WKUserContentController.init(); wkUController.addUserScript(wkUScript); let wkconfig = WKWebViewConfiguration.init(); wkconfig.userContentController = wkUController; _webView = WKWebView.init(frame: CGRect.init(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height), configuration: wkconfig); self.view.addSubview(_webView); let htmlfile = Bundle.main.path(forResource: "test", ofType: ".html"); let url = URL.init(fileURLWithPath: htmlfile!); let request = URLRequest.init(url: url); _webView.load(request); 参考 https://blog.csdn.net/GYMotgm/article/details/77944163

November 4, 2019 · 1 min · holdsky

iOS xcodebuild自动构建常用命令

列出工作空间中的所有scheme xcodebuild -list -workspace abc.xcworkspace 输出 Information about workspace "abc": Schemes: abc AFNetworking FMDB GTMBase64 Minizip Pods-abc 列出项目的所有target及Configurations xcodebuild -list -project abc.xcodeproj 输出 Information about project "abc": Targets: abc Build Configurations: Debug Release If no build configuration is specified and -scheme is not passed then "Release" is used. Schemes: abc 编译指定的scheme或Target 指定scheme xcodebuild -workspace abc.xcworkspace -scheme test 或者 xcodebuild -project abc.xcodeproj -scheme test 此时默认编译 Release 版 ...

October 30, 2019 · 1 min · holdsky