MobileCushion
MobileCushion

Reputation: 7095

Semantic issue: Use of undeclared identifier when adding Framework class references

I've added some frameworks into my project, through the Targets -> Build Phases -> Link binary with Libraries. In particular, I am talking about the AVFoundation.framework. I've also added all the frameworks into the Frameworks folder in the project navigator.

However, when I try to reference classes in the linked frameworks, I'm getting "Semantic issue - Use of undeclared identifier" errors.

For example, I'm getting these errors in the two bottom lines:

    - (void)viewDidLoad {
    [super viewDidLoad];
    AVCaptureSession *session = [[AVCaptureSession alloc] init];
    session.sessionPreset = AVCaptureSessionPresetMedium;
}

I'm wondering if the frameworks are being properly linked to my project. So, how can I solve this? I must say that I am new to iOs and ObjC development.

Thank you

Upvotes: 5

Views: 3476

Answers (2)

Manish Singh Chouhan
Manish Singh Chouhan

Reputation: 391

In my case, the import statements are in the middle of this block #ifdef FB_SONARKIT_ENABLED / #endif After taking them back from the blocks, archiving was succeeded.

Before

#import "AppDelegate.h"

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

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
...
#endif

After

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <RNGoogleSignin/RNGoogleSignin.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
...
#endif

Upvotes: 0

CAMOBAP
CAMOBAP

Reputation: 5657

Looks like You forgot:

#import <AVFoundation/AVCaptureSession.h>

Upvotes: 11

Related Questions