运行环境区块
阻止三种最常见的错误方向:提议用原生重写、用弹窗破坏 OAuth,以及把仅限网页的横幅带进应用。User-Agent 标记在 WebViewGold 中设置:Config.swift 中的 useragent_iphone / useragent_ipad,Config.java 中的 USER_AGENT。
Cursor
Cursor 会把项目规则应用到聊天、Composer 和代理运行中。对于通过 WebViewGold 发布的应用,这些规则应该包含 WebView 运行环境、桥接语法和商店检查清单,这样代理就不会再提出只适用于浏览器的方案。下面是一套包含两个文件的模板及其用法。
每个平台一次性 $109 起,或由我们的团队全程代劳,$698 起。
项目规则以 .mdc 文件的形式存放在 .cursor/rules/ 中:带有一小段 front matter 的 Markdown,由 front matter 决定规则何时加载。alwaysApply: true 会把它放进每一次对话;globs 会在匹配的文件处于上下文中时自动附加该规则;只写 description 则让代理在判断规则相关时自行引入;您也可以随时用 @ 按名称引用某条规则。仓库根目录中旧式的单个 .cursorrules 文件仍然有效,但新项目应该使用文件夹,因为它允许一条始终生效的规则加上若干条限定范围的规则。
这种拆分正是 WebViewGold 应用所需要的:WebView 运行环境和商店规则始终生效,而移动端布局规则只在代理编辑界面文件时附加,这样就不会干扰后端工作。
保存为 .cursor/rules/webviewgold-app.mdc。替换占位符,并删除您用不到的桥接行。每个 scheme 都取自WebViewGold iOS 文档和Android 文档。
---
description: WebView runtime context, WebViewGold bridge and store rules for this app
alwaysApply: true
---
# Runtime
- This web app (production: https://app.example.com) is also published as native iOS and
Android apps with WebViewGold. The native apps load the production URL in a WebView.
There is no separate mobile codebase; never propose React Native, Expo or Capacitor.
- The native app sets the user agent marker `MYAPPNATIVE`. Detect it only via
`isNativeApp()` in `src/lib/platform.ts`.
- Google/Facebook OAuth is handled by the wrapper (Social Login Helper); Sign in with
Apple is handled automatically. Do not open OAuth in new windows or popups.
- When `isNativeApp()`: no "Download our app" or "Add to home screen" banners, no cookie
banner unless legally required, no service worker install prompts.
# WebViewGold bridge (native app only, always with a web fallback)
Call a feature by navigating: `window.location.href = "scheme://..."`. Results arrive
asynchronously as global variables or callbacks; poll with a timeout.
- Push permission prompt: `registerpush://`; status: `checkNativePushPermissions://` -> `nativePushEnabled`
- OneSignal subscription ID: `getonesignalplayerid://` -> `onesignalplayerid`
- Local notification: `sendlocalpushmsg://push.send?s=SECONDS=msg!MESSAGE&!#TITLE&!#URL`
- Share sheet: `shareapp://message?=TEXT&url=URL`
- Haptics: `lighthaptic://`, `mediumhaptic://`, `heavyhaptic://`, `successhaptic://`, `warninghaptic://`, `errorhaptic://`
- Biometrics: `bioauth://` -> iOS callbacks `onBioAuthSuccess()`, `onBioAuthFailure(code, msg)`, `onBioAuthUnavailable()`
- QR scanner: `qrcode://` (scanned URL is loaded); barcode: `barcodescanner://` -> `barcodescanresult`
- Purchases (RevenueCat): `revenuecat://purchase?external_id=USER_ID&product=PRODUCT_ID`;
restore `restoreinapppurchases://`; manage `cancelinapppurchase://`
- App version: `getappversion://` -> `versionNumber`, `bundleNumber`; install ID: `get-uuid://` -> `uuid`
- Full reference: https://www.webviewgold.com/llms-full.txt (read it before using any other scheme)
# Store rules (invariants)
- /privacy and /terms are real routes linked from footer and settings.
- Sign-up exists => Delete account exists (server-side deletion) plus a public /delete-account page.
- Third-party login exists => Sign in with Apple is offered with equal prominence.
- Digital goods, subscriptions and credits in the native app go through `revenuecat://`;
Stripe only for browser users and for physical goods. No external payment links in the app.
- Every fetch has loading, empty, error and retry states; never a blank screen.
- User-generated or AI-generated content has report and block actions.
- No placeholder text, dead links or mixed content.
# Done means
Works in a desktop browser and at 320px; native code behind `isNativeApp()`;
no new store-rule violations; lint and tests pass; summarize device tests I must run.保存为 .cursor/rules/mobile-ui.mdc。根据您的文件夹结构调整 globs。
---
description: Mobile layout rules for screens rendered inside the native WebView apps
globs: src/components/**/*.tsx, src/app/**/*.tsx, src/pages/**/*.tsx, src/**/*.css
alwaysApply: false
---
- Viewport: `width=device-width, initial-scale=1, viewport-fit=cover` must stay in the document head.
- No horizontal overflow between 320px and 1024px; test flex and grid children with `min-width: 0`.
- Tap targets at least 44x44px; spacing between adjacent targets at least 8px.
- Fixed or sticky headers, footers, tab bars and bottom sheets use
`padding-top: env(safe-area-inset-top)` / `padding-bottom: env(safe-area-inset-bottom)`.
- Inputs and selects use `font-size: 16px` or larger (prevents zoom on iOS).
- No hover-only interactions; every hover state has a tap equivalent.
- Images and embeds have explicit width and height or aspect-ratio to avoid layout shift.
- Long lists are paginated or virtualized; a WebView has less memory than a desktop tab.
- Prefer in-app bottom navigation over a hamburger menu in the native app.
- Dark mode: respect `prefers-color-scheme` or provide a setting; never pure white flashes on navigation.
在过去5年我们尝试过的所有应用平台中,WebViewGold为我们带来了有史以来最短、最高效的上市时间。我不知道为什么没有更早发现你们,但我真的非常满意。目前我们的应用在iOS App Store和Google Play商店的下载量已超过6000次,没有任何问题!
阻止三种最常见的错误方向:提议用原生重写、用弹窗破坏 OAuth,以及把仅限网页的横幅带进应用。User-Agent 标记在 WebViewGold 中设置:Config.swift 中的 useragent_iphone / useragent_ipad,Config.java 中的 USER_AGENT。
准确的 scheme 和结果变量名称。没有它,Cursor 就会编造一个 window.native 对象,或者转而使用 Web Share API。最后一行会把所有未列出的内容都指向完整文档。
写成不变量,这样它们适用于以后的每个任务,并会在结束时被检查。支付规则能避免代价最高的拒审(Apple 3.1.1);删除和 Sign in with Apple 规则能避免最常见的拒审(5.1.1、4.8)。
只在界面文件处于上下文中时自动附加,从而让后端对话保持干净。它与审核人员依据准则 4.0 和 Google 功能失效政策所用的检查清单相同。
在代理模式下,Cursor 会制定计划、编辑文件、运行命令并反复迭代。始终生效的规则是每个计划的一部分,所以当您要求“在钱包页面加一个 Face ID 锁”时,计划里已经写好了:用 isNativeApp() 做判断,跳转到 bioauth://,实现 iOS 回调,在网页端保留密码作为备用方案,并保留服务器端校验。代理一打开组件文件,移动端规则就会加入上下文。
有两个习惯能让它更可靠。第一,把 WebViewGold 文档作为文档来源添加到 Cursor 中(@Docs 功能接受 URL;使用 https://www.webviewgold.com/llms-full.txt),这样代理就能阅读具体功能的章节,而不是去猜。第二,在功能类提示词的结尾加上“对照 WebViewGold 文档和商店规则检查结果”,代理在汇报之前就会把两者都重读一遍。llms.txt 指南详细介绍了这套验证流程。
在 /wallet 路由前面添加一个生物识别锁。遵循项目规则:在原生应用中,跳转到规则里的生物识别 scheme,并处理成功、失败和不可用这三种回调;在网页端,退回到重新输入密码。解锁状态在 session storage 中保存 5 分钟,并且服务器仍须在每次钱包请求时验证会话。锁屏页面要遵守移动端界面规则。然后对照 https://www.webviewgold.com/llms-full.txt 和商店规则检查您的结果,并列出您验证过的内容。
新项目请使用 .cursor/rules 文件夹;它支持多条限定范围的规则,以及控制每条规则何时加载的 front matter。如果您已有旧式的 .cursorrules 文件,它仍然有效。
规则用于聊天、Composer 和代理对话。行内补全由周围的代码驱动,这也是要把 isNativeApp() 和桥接调用集中在一个命名清晰的辅助文件中的另一个原因。
把它添加为文档来源(在 @Docs 中填入 URL),在提示词中用 @Web 引用它,或者把一份副本提交到仓库并在规则中注明路径。提交副本的方式结果最确定。
Web 应用可以。原生构建在 iOS 上需要 Xcode,或者使用 WebViewGold Cloud Builder,它可以在浏览器中构建并上传两个应用。
结果相同,只是您需要投入的工作量不同。三种方式都附带审核通过保证和 7×24 小时人工支持。
$109 每个平台,一次性付费
WebViewGold 许可证:一个现成的 Xcode 或 Android Studio 项目。粘贴您的 URL,设置名称和图标,开启所需功能,构建并提交。永久免费更新。
在主页查看方案$349 每个许可证,一次性附加购买
无需 Mac、Xcode 或 Android Studio:在浏览器中完成配置,我们在云端构建两个应用,并将其交付到 App Store Connect 和 Play Console。
Cloud Builder 如何运作 试用免费演示$698 每个平台 $798
把您的 URL 和图标发给我们。我们的团队在 72 小时内完成配置、构建并交付您的应用,白标,附源码项目。两个平台共 $1,158。
Full Service 详情 服务提供方:冬季特惠价格有效期至 2026年12月31日。
App Store & Google Play 审核通过保证 – 否则 14 天内退款
想直接交给我们?Full Service:我们在 72 小时内完成配置、构建并交付,每个平台 $698 起。有疑问?通过 7×24 小时在线聊天联系我们。
退款依据我们 FAQ 中列出的条件:应用因非内容原因被 Apple 和/或 Google 拒审,并在购买后 14 天内提出申请。