خرید بک لینک

Vote count: 0

but I have noticed that my bridge variable is nil whenever I call on it from another method. I believe this is because the bridge is only set when calling on a bridged method from javascript. I have tried everything from creating delegate to create a SingleTon class. None of the above work and I caot figure out why it is only available in the method that I called from Javascript. Here is my class

Helper.h

#import "RCTBridge.h"
#import "AppDelegate.h"
#import "RCTEventEmitter.h"

@interface Helper : RCTEventEmitter <RCTBridgeModule>

-(void) auth;

@end

Here is my .m file: Helper.m

#import "AppDelegate.h"
#import "Helper.h"
#import "RCTBridge.h"
#import "RCTEventDispatcher.h"

@implementation Helper
RCT_EXPORT_MODULE();

@synthesize bridge = _bridge;

- (NSArray<NSString *> *)supportedEvents {
  retu @[@"SpotifyHelper"];
}


RCT_EXPORT_METHOD(auth)
{
  [self.bridge.eventDispatcher sendDeviceEventWithName:@"SpotifyHelper" body:@{@"Login": @true}];
  printf("Auth");
}

RCT_EXPORT_METHOD(play:(NSString *) uri first: id)
{
  AppDelegate *appDelegate = [[AppDelegate alloc] init];
  [appDelegate play:uri second:id];
}

@end

I call on that method from inside of my delegate like this:

[[AppDelegate alloc] init] auth]

Which is the reason I believe it is not initialized. I'm not sure how to get the RCTBridge variable to not be nil. Any help?

asked 50 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 18 مرداد 1395 ساعت: 3:48

صفحه بندی