QuickBlocks QBSettings getting undeclared identifier - ios

I have included the API Frameworks but still get error : Use of undeclared identifier 'QBSettings' in AppDelegate.m file.
#import <FYX/FYX.h>
#import "AppDelegate.h"
#import "ApplicationContext.h"
#import "EnableProximityViewController.h"
#import "LoginViewController.h"
#implementation AppDelegate
#synthesize window = _window;
#synthesize loginViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Set QuickBlox credentials (You must create application in admin.quickblox.com)
[QBSettings setApplicationID:11948];
[QBSettings setAuthorizationKey:#"SHdXhhjVY7BL-GtGH"];
[QBSettings setAuthorizationSecret:#"3ZYjkXTzaUfd6kLTL"];
[QBSettings setAccountKey:#"yFHpgFbxe3hjkMXmjs9sv9u"];

Found the answer...
Go to App-Name.pch then add the import to the Framework file. This is how it links back.
#import <Quickblox/Quickblox.h>

Related

Use of undeclared identifier 'FIRApp'

After import the Firebase.h file i wrote "[FIRApp configure]" on "- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions". While running on the simulator it is showing "Use of undeclared identifier 'FIRApp'". But if select "Generic iOS device" option for build, no error is coming. Build and Archive working as properly. But on local simulator issue is coming.I have to run the app on Simulator first for crash communications with Firebase server. Please give me solution.enter
In AppDelegate.m file, you should import firebase like #import <Firebase.h> before #ifdef FB_SONARKIT_ENABLED line.
As I understand, You probably get success on dev build because FlipperKit libraries are used for debugging and this #ifdef FB_SONARKIT_ENABLED if condition is satisfied. When you try to archive it will not be imported and the variables will be undeclared because #import <Firebase.h> remains in that if condition.
FIRApp is moved (or initially was) to FirebaseCore framework. So.
#import <FirebaseCore/FirebaseCore.h>.
As stated in this github comment:
What work for me
Just add
#import <Firebase.h> to the AppDelegate.h as well
Source:
I have a same problem but I haven't FB_SONARKIT_ENABLED
#import <React/RCTAppSetupUtils.h>
#if RCT_NEW_ARCH_ENABLED
#import <Firebase.h>
#import <FirebaseCore/FirebaseCore.h>
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
static NSString *const kRNConcurrentRoot = #"concurrentRoot";
#interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
RCTTurboModuleManager *_turboModuleManager;
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
facebook::react::ContextContainer::Shared _contextContainer;
}
#end
#endif
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
RCTAppSetupPrepareApp(application);
enter image description here
In the react native firebase docs (see here: https://rnfirebase.io/) it says put the #import <Firebase.h> at the top of the document. You imported #import <Firebase.h> below #if RCT_NEW_ARCH_ENABLED, so you basically import firebase module if the RCT_NEW_ARCH_ENABLED condition is true.
you should do :
#import <Firebase.h>
#import <React/RCTAppSetupUtils.h>
#if RCT_NEW_ARCH_ENABLED
#import <FirebaseCore/FirebaseCore.h>
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>

Send custom iOS native errors with sentry-expo

I want to capture the iOS native errors to Sentry and also capture some custom messages.
I'm using the sentry-expo library but this only captures javascript errors even with the parameter:
deactivateStacktraceMerging: false
I'v been following the official installation guide https://docs.sentry.io/clients/react-native/ but I'm stuck when trying to configure the AppDelegate.m file
#import "AppDelegate.h"
#import "ExpoKit.h"
#import "EXViewController.h"
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>
#if __has_include(<React/RNSentry.h>)
#import <React/RNSentry.h> // This is used for versions of react >= 0.40
#else
#import "RNSentry.h" // This is used for versions of react < 0.40
#endif
#interface AppDelegate ()
#property (nonatomic, strong) EXViewController *rootViewController;
#end
#implementation AppDelegate
-(EventsObserver*)getEventsObserver
{
return EventsObserver.shared;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Fabric with:#[[Crashlytics class]]];
[application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum];
_window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
_window.backgroundColor = [UIColor whiteColor];
[[ExpoKit sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
_rootViewController = [ExpoKit sharedInstance].rootViewController;
_window.rootViewController = _rootViewController;
[_window makeKeyAndVisible];
[self getEventsObserver];
[RNSentry installWithRootView:rootView];
return YES;
}
At this point I don't have the rootView object of type RCTRootView. I'm using a EXViewController and the library does not support that type of object to invoke the function installWithRootView. Am I following a wrong path?

AppDelegate update with Firebase

I need to add the following code to my main AppDelegate, I have 2 files called AppDelegate, AppDelegate.m, AppDelegate.h, which one do I need to edit?
Neither file has #import they both have #import
#import UIKit;
#import Firebase;
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
return YES;
}
#import is available since iOS 7 and is an improvement on #import (see for example this blogpost for more info). You should be able to use #import Firebase;, but otherwise it'd be #import <Firebase/Firebase.h>

Cannot find protocol declaration for 'OSSubscriptionObserver'

This code
#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#elif __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#endif
#if __has_include(<OneSignal/OneSignal.h>)
#import <OneSignal/OneSignal.h>
#else
#import "OneSignal.h"
#endif
#interface RCTOneSignal : NSObject <RCTBridgeModule, OSSubscriptionObserver>
- (id)initWithLaunchOptions:(NSDictionary *)launchOptions appId:(NSString *)appId;
- (id)initWithLaunchOptions:(NSDictionary *)launchOptions appId:(NSString *)appId settings:(NSDictionary*)settings;
+ (void)didReceiveRemoteNotification:(NSDictionary *)dictionary;
#end
This problem or error :
Cannot find protocol declaration for 'OSSubscriptionObserver'
Thanks for advance. :)

Changing AppDelegate file of example I want to use in my app

Hi all I'm new in creating app for iOS , so sorry if the question stupid a little .
I'm trying to build app where log in to Facebook and getting friend list is only a part, so I want to use the example providing from Facebook to developers , but it have appDelegate file with some methods like this:
#import "FPAppDelegate.h"
#import "FPViewController.h"
#implementation FPAppDelegate
#synthesize window = _window;
#synthesize rootViewController = _rootViewController;
- (BOOL)application:(UIApplication *)application
.......
return [FBSession.activeSession handleOpenURL:url];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FBFriendPickerViewController class];
........
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application {
[FBSession.activeSession close];
}
And it have xib file for FPViewController with h and m files, so what the better way to use this example in my app, I understand that I can't use two appDelegate files, and I trying to change FPAppDelegate that is UIResponder to UIViewController class to push it from some place in my app like this:
- (IBAction)loginFacebook:(id)sender
{
NSLog(#"Facebook");
delegateViewController *appDelegate = [[delegateViewController alloc] initWithNibName:nil bundle:NULL];
[self.navigationController pushViewController: appDelegate animated:YES];
}
where delegateViewController is FPAppDelegate of example I changing to:
#import "delegateViewController.h"
#import "AppDelegate.h"
#import "FPViewController.h"
#interface delegateViewController ()
#end
#implementation delegateViewController
#synthesize window2=_window2;
#synthesize rootViewController2=_rootViewController2;
- (BOOL)application:(UIApplication *)application
......
return [FBSession.activeSession handleOpenURL:url];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FBFriendPickerViewController class];
......
self.window2 = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window2.rootViewController = navigationController;
[self.window2 makeKeyAndVisible];
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application {
........
[FBSession.activeSession close];
}
but it's not working, so, if I need to change also xib file? Or to change appDelegate file of my project? Or existing another way to use this example in my app? I would like you to explain this to me.
You should start by working through the Apple tutorials so you can understand the UIKit framework to start developing an iOS app.
http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/chapters/Introduction.html

Resources