需要帮助以尝试对我的独立EXPO项目实施react-native-firebase

时间:2019-06-14 09:46:32

标签: objective-c xcode firebase react-native

正如标题所述,我尝试在独立的expo项目中添加一些代码以使用react-native-firebase接收推送通知。

我对obj-c和iOS环境有点陌生,所以这可能是一个愚蠢的问题。但是我在stackoverflow中找不到解决方案。

所以我的问题是:我可以在现有协议EXStandaloneAppDelegate中添加UIResponder协议吗?

我的AppDelegate.m


#import "AppDelegate.h"

#import <Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

@implementation AppDelegate

// Put your app delegate methods here. Remember to also call methods from EXStandaloneAppDelegate superclass
// in order to keep Expo working. See example below.



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    [FIRApp configure];
    RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

// here the problem merges: Sending 'AppDelegate *const __strong' to parameter of incompatible type 'id<RCTBridgeDelegate>'


    RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                     moduleName:@"push"
                                              initialProperties:nil];

    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    UIViewController *rootViewController = [UIViewController new];
    rootViewController.view = rootView;
    self.window.rootViewController = rootViewController;
    [self.window makeKeyAndVisible];
    return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
    return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
    return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}




@end


我的AppDelegate.h

#import <UIKit/UIKit.h>
#import <ExpoKit/EXStandaloneAppDelegate.h>
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : EXStandaloneAppDelegate <UIApplicationDelegate> UIResponder <UIApplicationDelegate, RCTBridgeDelegate>

    @property (nonatomic, strong) UIWindow *window;

// this gives me an error
'Prefix attribute must be followed by an interface or protocol'

@end

@interface Appdelegate应该采用UIresponder协议,而不仅仅是EXStandaloneAppDelegate。

0 个答案:

没有答案