简体   繁体   中英

App is keep on Crashing [FBLPromise HTTPBody] unrecognized selector sent to instance

I've integrated Firebase with my iOS project and all necessary steps mentioned here https://firebase.google.com/docs/cloud-messaging/ios/client but its keep on crashing on this line [FIRApp configure] , inside - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

this is the error I'm getting Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBLPromise HTTPBody]: unrecognized selector sent to instance

stupid but it works

//   GlobalImport.pch
#ifndef GlobalImport_pch
#define GlobalImport_pch
#import "FBLPromise+Extension.h"
#endif
//  FBLPromise+Extension.h
#if __has_include(<FBLPromises/FBLPromises.h>)
#import <FBLPromises/FBLPromises.h>
#else
#import "FBLPromises.h"
#endif

@interface FBLPromise (Extension)

@property(nonatomic, readonly) NSHTTPURLResponse *HTTPResponse;
@property(nonatomic, readonly) NSData *HTTPBody;

- (instancetype)initWithResponse:(NSHTTPURLResponse *)response HTTPBody:(NSData *)body;

@end
//  FBLPromise+Extension.m
#import "FBLPromise+Extension.h"

@implementation FBLPromise (Extension)
+ (NSData *)HTTPBody {
    return nil;
}

- (NSData *)HTTPBody {
    return nil;
}

+ (void)setHTTPBody:(NSData *)data {
}

- (void)setHTTPBody:(NSData *)data {
}

+ (NSHTTPURLResponse *)HTTPResponse {
    return nil;
}

- (NSHTTPURLResponse *)HTTPResponse {
    return nil;
}

+ (void)setHTTPResponse:(NSHTTPURLResponse *)data {
}

- (void)setHTTPResponse:(NSHTTPURLResponse *)data {
}

+ (instancetype)initWithResponse:(NSHTTPURLResponse *)response HTTPBody:(nullable NSData *)body {
    return nil;
}

- (instancetype)initWithResponse:(NSHTTPURLResponse *)response HTTPBody:(nullable NSData *)body {
    return nil;
}
@end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM