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

1

6

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

Quarterage answered 19/5, 2021 at 11:55 Comment(0)
M
2

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

Mickiemickle answered 24/5, 2021 at 15:33 Comment(2)
Please develop this answer better. Just a bunch of code won't help.Exertion
Nullability specifier 'nullable' conflicts with existing specifier 'nonnull' .. we get this error for - (instancetype)initWithResponse:(NSHTTPURLResponse *)response HTTPBody:(nullable NSData *)body {Diageotropism

© 2022 - 2024 — McMap. All rights reserved.