我的问题(后台通知):
我正在使用React Native Firebase。一切都很好,直到最近我更新到了该库的 6.7.1 版本。更新后后台通知(应用程序关闭时)停止工作。前台正在工作。
我在这里找到了一个建议,可以转到FirebaseAppDelegateProxyEnabledinfo.plistYES中。
它确实有效!我现在可以正常接收通知了。
但什么是调酒呢?
我真的不明白这种 swizzling 方法是什么,设置它YES或NOdo 之间有什么区别?我在 firebase 文档中读到了它:Method swizzling in Firebase Cloud Messaging。我真的无法理解。有人可以以更清楚的方式解释一下,这有什么区别?
I am implementing PWA into my project, I have setted up the serviceworker.js, and I am using workbox.js for cache routing and strategies.
1- I add the offline page to cache on install event, when a user first visit the site:
/**
* Add on install
*/
self.addEventListener('install', (event) => {
const urls = ['/offline/'];
const cacheName = workbox.core.cacheNames.runtime;
event.waitUntil(caches.open(cacheName).then((cache) => cache.addAll(urls)))
});
Run Code Online (Sandbox Code Playgroud)
2- Catch & cache pages with a specific regex, like these:
https://website.com/posts/the-first-post
workbox.routing.registerRoute(
new RegExp('/posts|/articles'), …Run Code Online (Sandbox Code Playgroud) 我的 service worker 安装在一个临时目录中
主要网站在: https:example.com
分期开启: https:example.com/test/
服务工作者路径: https:example.com/test/serviceworker.js
这是我注册服务工作者的方式:
navigator.serviceWorker.register('https:example.com/test/serviceworker.js', {scope: '/test/'})
.then(registration => {
console.log(`Service Worker registered! Scope: ${registration.scope}`);
})
Run Code Online (Sandbox Code Playgroud)
Service Worker 工作正常,并已安装。
我担心的是,在 serviceworker.js 中,我想使用/自动指向当前目录的路径,在这种情况下:/staging/
例如,当我想在临时站点中缓存主页时
/**
* Cache the homepage.
*/
workbox.routing.registerRoute('/', workbox.strategies.staleWhileRevalidate();
Run Code Online (Sandbox Code Playgroud)
这里的缓存https:example.com不是https:example.com/test/
我知道我可以简单地更改registerRoute('/')为registerRoute('/staging/)'
但这效率不高,并且会使我需要为 localhost、暂存和部署使用不同版本的 serviceworker。我想知道在此处执行此操作的正确方法是什么,因此我可以将范围“/”设置为 serviceworker.js 所在的当前目录。谢谢。
我最近刚刚添加了抽屉导航器并将我的屏幕包裹在 createDrawerNavigator()
这些是我目前的路线:
当用户从Home导航到Post 时,我传递一个包含 post 数据的参数。
onPress={() => this.props.navigation.navigate('Post', {postData: postData})}
Run Code Online (Sandbox Code Playgroud)
当用户从Post返回Home时,post 将被卸载。并在单击另一篇文章时重新安装新数据。
我的问题是,通过实施抽屉,导航回主页时不会卸载帖子屏幕,我一遍又一遍地不断打开第一个帖子的相同道具和屏幕。
这是我的路线设置:
onPress={() => this.props.navigation.navigate('Post', {postData: postData})}
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我希望每个帖子屏幕在从主页导航到它时打开并重新呈现为新的。
我看到这用于清漆vcl if语句"〜"
if (req.url ~ "phpMyAdmin") {
return (pass);
}
Run Code Online (Sandbox Code Playgroud)
我知道它有点像==时间in_array()
if ( req.http.User-Agent ~ "(Android|iPhone|iPad|BlackBerry|SAMSUNG)")
return(pass);
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释它实际意味着什么.它也是一个默认的php运算符吗?它和使用之间有什么区别==