我在我的应用程序中启用了 NotificationServiceExtension。并做了以下
以下是我的 NotificationService 的didReceiveNotificationRequest方法
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.bestAttemptContent = [request.content mutableCopy];
self.bestAttemptContent.badge = @20;
self.contentHandler(self.bestAttemptContent);
Run Code Online (Sandbox Code Playgroud)
}
不知道我在这里缺少什么。搜索并关注了这么多文件。似乎没有任何工作。
我正在使用 XCode 11.2.1 和带有 ios 版本 13 的真实设备。
我正在使用反应表。我已经为一列定义了 onRowClick() 函数。这里选择文本应该突出显示文本,点击必须重定向到另一个页面。现在,当我尝试选择文本时,它会被重定向。如何在不触发点击事件的情况下选择文本?
以下是我的 onRowClick 函数:
onRowClick = (state, rowInfo, columnInfo) => {
return {
onClick: (e, handleOriginal) => {
if (columnInfo.id) {
this.props.history.push(`/downloads/${rowInfo.original.id}`);
} else if (handleOriginal) {
handleOriginal();
}
}
};
}
Run Code Online (Sandbox Code Playgroud)
以下是我的反应表组件:
<ReactTable
manual
getTdProps = {this.onRowClick}
data = {results}
onFetchData = {this.onFetchData}
sortable = {false}
showPagination = {false}
noDataText = 'no data found'
columns = {[
{
Header: 'Id',
maxWidth: 50,
accessor: "id",
Cell: (props) => <span className="btn-link pointer">{props.value} </span>
},
{
Header: 'Processed on',
maxWidth: …Run Code Online (Sandbox Code Playgroud) 我有一个react-create-app应用程序,其中我使用firebase进行推送通知。最近我将firebase从 8.* 升级到 9.*。获取推送令牌时,会抛出以下错误:
FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('https://9fd5-49-204-137-92.ngrok.io/firebase-cloud-messaging-push-scope') with script ('https://9fd5-49-204-137-92.ngrok.io/firebase-messaging-sw.js'): The script has an unsupported MIME type ('text/html'). (messaging/failed-service-worker-registration).
Run Code Online (Sandbox Code Playgroud)
在 firebase.js 中,我有以下代码集,它会引发上述错误
import { initializeApp } from "firebase/app"
import { getToken, getMessaging, onMessage } from "firebase/messaging";
const message_key = "key"
var firebaseConfig = {
apiKey: "apikey",
authDomain: "authdomain",
projectId: "project-app",
storageBucket: "******.com",
messagingSenderId: "id",
appId: "appid",
measurementId: "mid"
};
const firebaseApp = …Run Code Online (Sandbox Code Playgroud) 我正在使用 React-native iOS 开发一个聊天应用程序。当收到通知时,当应用程序被用户杀死或强制退出时,我想在主应用程序图标上做一个徽章增量。当应用程序处于后台模式时,它运行良好。但是当应用程序处于非活动状态时不会调用didReceiveRemoteNotification方法。对此有什么想法吗?我在AppDelegate的didReceiveRemoteNotification方法中添加了代码。
在 AppDelegate 文件中添加了以下代码集
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
[RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
NSLog(@"APPDELEGATE: didReceiveRemoteNotification:fetchCompletionHandler %@", userInfo);
int badge = (int) application.applicationIconBadgeNumber;
if ( application.applicationState == UIApplicationStateInactive ) {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge+1];
}
else if(application.applicationState == UIApplicationStateBackground) {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge+1];
}
else if(application.applicationState == UIApplicationStateActive) {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge+1];
}
completionHandler(UIBackgroundFetchResultNewData);
}
Run Code Online (Sandbox Code Playgroud) objective-c push-notification apple-push-notifications ios react-native
我需要在索引页上显示 attr_accessor 值。对于分页,我使用 pagey gem。下面是代码块:
def index
@posts = Post.all
@posts.map do |post|
post_info = get_post_info(post.url)
post.update_attribute(:icon, post_info["icon"])
post.update_attribute(:subtitle, post_info["subtitle"])
end
print @posts[0].icon
@pagy, @posts = pagy(@posts)
end
Run Code Online (Sandbox Code Playgroud)
第一篇文章的打印图标在控制器中提供了正确的 url。
当我post.icon在视图文件中使用时,它为零。如果我直接发送@posts而不使用pagey,它会按预期工作。怎么解决这个问题呢?
这是没有 pagey 的代码
def index
@posts = Post.all
@posts.map do |post|
post_info = get_post_info(post.url)
post.update_attribute(:icon, post_info["icon"])
post.update_attribute(:subtitle, post_info["subtitle"])
end
end
Run Code Online (Sandbox Code Playgroud)
这是我的视图代码:
索引.html.erb
<div class="">
<%= render partial: "posts/index", collection: @posts, as: :post %>
</div>
Run Code Online (Sandbox Code Playgroud)
_index.html.erb如下
<div class="flex mb-4">
<div class="rounded float-left mr-3 my-3" style=";">
<% if !post.icon.nil? …Run Code Online (Sandbox Code Playgroud) 我在 Rails 应用程序中使用 Keycloak gem。根据 keycloak 文档,keycloak 使用 cookie。在我的应用程序中,我使用 Redis 缓存存储来存储这些 cookie。
config.session_store :cache_store, key: ENV['APP_SESSION_KEY']
Run Code Online (Sandbox Code Playgroud)
它抛出以下
raise CookieOverflow if options[:value].bytesize > MAX_COOKIE_SIZE
ActionDispatch::Cookies::CookieOverflow
Run Code Online (Sandbox Code Playgroud)
如果我使用active_record_store它工作正常。但我真的需要使用redis_cache_store。
我该如何处理?
ruby-on-rails session-cookies redis-cache rails-activerecord keycloak
objective-c storyboard ios uicollectionview uicollectionviewcell
需要配置nginx在同一个域中有多个服务。
我的 nginx.conf 文件如下
server {
listen 80;
listen [::]:80;
server_name www.example.com example.com;
access_log /var/log/nginx/host.access.log main;
location ^~ /.well-known/acme-challenge/ {
alias /var/www/acme-challenge/;
}
return 301 https://$host$request_uri;
}
server {
listen 443;
listen [::]:443;
server_name www.example.com example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl on;
access_log /var/log/nginx/host.access.log main;
#
# # Enable server-side protection against BEAST attacks
# ssl_protocols TLSv1.2;
#
ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
location ^~ /.well-known/acme-challenge/ {
alias /var/www/acme-challenge/;
}
location /cms/ {
proxy_pass http://cms-container:1337;
rewrite ^/sdcms/?(.*)$ /$1 break;
proxy_set_header Host $host;
proxy_set_header …Run Code Online (Sandbox Code Playgroud) ios ×4
objective-c ×4
reactjs ×2
events ×1
firebase ×1
keycloak ×1
nested ×1
nginx ×1
pagy ×1
react-native ×1
redis-cache ×1
scrollview ×1
storyboard ×1