在外部唤醒iOSApp

URL Scheme、Universal Links两种方式都可以,但是Universal Links方式更稳定。iOS13+以上环境URL Scheme方式可能被系统拦截。 URL Scheme方式 配置Info.plist 打开App工程的Info.plist ,添加URL types CFBundleURLTypes CFBundleURLName 一个名字,例如myapp CFBundleURLSchemes 自定义scheme,例如myapptest AppDelegate回调 func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { //解析url,路由到App内对应页面 myapptest://xxx/yyy?zzz=123 print(url) return true } SceneDelegate回调(iOS13+) func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { guard let context = URLContexts.first else { return } let url = context.url //解析url,路由到App内对应页面 myapptest://xxx/yyy?zzz=123 print("SceneDelegate 收到scheme url:\(url)") } 外部唤醒 以 Safari 为例 <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>唤醒测试</title> </head> <body> <a href="myapptest://xxx/yyy?zzz=123">通过URL Scheme唤醒</a> </body> </html> Universal Links方式 请先阅读配置Apple-Universal-Links ...

August 21, 2026 · 1 min · holdsky

在外部唤醒Android App

有三种方式 Intent 、 URL Scheme 、 AppLinks 可以唤醒Android App。 部分Android手机可能没有GMS服务,本文不讨论AppLinks方式。 配置 AndroidManifest.xml 在AndroidManifest.xml中配置以下信息,主要是暴露唤醒方式和scheme。 本文假设包名为 com.test.myapp 、自定义scheme为 testscheme、被唤醒的Activity为TestEntryActivity <?xml version="1.0" encoding="utf-8"?> <manifest > <application <!-- 通过 INTENT URL SCHEME 唤醒自己--> <activity android:name="com.test.myapp.TestEntryActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="true" android:taskAffinity="com.test.myapp" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="testscheme" /> </intent-filter> </activity> </application> </manifest> 创建 Activity 在包名com.test.myapp创建TestEntryActivity代码文件,代码内容如下: public class TestEntryActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 全新唤醒 Intent intent = getIntent(); Uri uri = intent.getData(); handleUri(uri,true); finish(); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // 后台切前台 Uri uri = intent.getData(); handleUri(uri,false); finish(); } private void handleUri(@NonNull Uri uri,boolean isColdLanuch) { if (isColdLanuch) { // 冷启动,应先运行App初始化业务逻辑,如Splash、检查账号权限、SDK初始化等 // 待App业务初始化完成后,再处理外部唤醒事件 return; } // 根据uri内容分发到对应的页面或者模块 } } 外部唤醒 以浏览器为例: ...

August 21, 2026 · 1 min · holdsky

旧工程在Xcode27环境无法运行到iOS27模拟器

旧工程在Xcode26及以下环境可以运行到模拟器,切换到Xcode27后,提示mismatched platform, 同时,Xcode27的建议如下 iPhone 17 iOS simulator platform doesn't match XXX.app's supported platforms .you can change xxx.app's Base SDK or Supported Platforms to suppport iPhone 17 实际上旧工程的Base SDK设置为iOS ,Supported Platforms 也为iOS,和新建工程是一致的。 对比新旧工程的配置,发现Excluded Architectures有区别。 旧工程: 新工程 需要把Excluded Architectures里指定的arm64配置给删除,或者填写空

August 14, 2026 · 1 min · holdsky

配置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