小编mKa*_*ane的帖子

React Native 地图获得可见标记

在 iOS 上,当使用地图套件时,我们能够获取可见地图矩形内的当前注释。这是使用 swift 的一个小片段

Array(myMap.annotations(in: myMap.visibleMapRect))
Run Code Online (Sandbox Code Playgroud)

这个库中有类似的方法或回调吗?

我的基本用途是了解用户何时更改区域(捏合缩放等)并获取仍然可见的当前标记数组。

react-native react-native-maps

7
推荐指数
1
解决办法
3044
查看次数

Firebase刷新令牌

使用方法

[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]

我不太确定参数的要求是什么?什么是授权实体和行动?我也将苹果的APNS令牌传递给该方法吗?

objective-c ios firebase firebase-cloud-messaging

5
推荐指数
2
解决办法
4781
查看次数

标签下的 React Native Tab Bar 空白

我正在使用带有 SafeAreaView 的标签栏导航器。

如果我注释掉标签栏导航,父视图将覆盖整个屏幕。但是,当我添加标签栏时,它会在标签栏部分下显示一个小的白色视图。

const App = () => {
  return (
    <SafeAreaView style={styles.droidSafeArea}>
      <View style={{ backgroundColor: "red", flex: 1 }}>
        <TabNavigator key="MainTabNav" />
      </View>
    </SafeAreaView>
  );
};

export default App;

const styles = StyleSheet.create({
  droidSafeArea: {
    flex: 1,
    backgroundColor: "#2F3438",
  }
});
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

tabbar react-native safeareaview

5
推荐指数
1
解决办法
1645
查看次数

NSWindow 关闭并重新打开后崩溃

我创建了一个 NSWindow

self.storeWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 800, 660) styleMask:NSWindowStyleMaskResizable|NSWindowListOrderedFrontToBack|NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:false];
                             [self.storeWindow setDelegate:self];
Run Code Online (Sandbox Code Playgroud)

打开很好,关闭也很好。但是,如果我再次调用 if 甚至检查 nil ,它会因 EXC_BAD_ACCESS 崩溃。

我在标头中将其声明为字符串属性

@property (strong,nonatomic) NSWindow *storeWindow;
Run Code Online (Sandbox Code Playgroud)
      if (self.storeWindow.contentView == nil) {
                            self.storeWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 800, 660) styleMask:NSWindowStyleMaskResizable|NSWindowListOrderedFrontToBack|NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:false];
                             [self.storeWindow setDelegate:self];
                        }
                        [self.storeWindow setBackgroundColor:[NSColor whiteColor]];
                        self.store = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 850, 640)];
                        [self.store loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:json[@"url"]]]];
                        [self.storeWindow.contentView addSubview:self.store];
                        [self.storeWindow makeKeyAndOrderFront:self.window];
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

macos objective-c nswindow

4
推荐指数
1
解决办法
1029
查看次数

UNUserNotificationCenter触发器不触发

我正在尝试使用iOS 10的UserNotifications框架。

如果我不传递触发器,则通知的工作似乎很棒。他们会立即在应用程序中显示。但是我需要为触发传递一个延迟。谁能看到我代码中的漏洞?它应该使它延迟15秒,但它永远不会熄灭。

UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
content.title = [NSString localizedUserNotificationStringForKey:@"Hello!" arguments:nil];
content.body = [NSString localizedUserNotificationStringForKey:@"Hello_message_body"
                                                     arguments:nil];
content.sound = [UNNotificationSound defaultSound];
content.categoryIdentifier = @"WhatUpsw";


NSString *imageName = @"hug2";

NSURL *url = [[NSBundle mainBundle]URLForResource:imageName withExtension:@"jpg"];


UNNotificationAttachment *attachment = [UNNotificationAttachment attachmentWithIdentifier:imageName URL:url options:nil error:nil];
content.attachments = @[attachment];                          

// Deliver the notification in five seconds.
UNTimeIntervalNotificationTrigger* trigger = [     UNTimeIntervalNotificationTrigger
                                              triggerWithTimeInterval:15 repeats:NO];

UNNotificationRequest* request = [UNNotificationRequest requestWithIdentifier:@"FiveSecondsw"
                                                                      content:content trigger:trigger];
// Schedule the notification.
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
    if …
Run Code Online (Sandbox Code Playgroud)

ios10 unusernotificationcenter

2
推荐指数
1
解决办法
1872
查看次数