AFNetworking Clang Error with Exit code 254 - Xcode 4.6.2 - afnetworking

I am trying to use AFNetworking with Xcode 4.6.2 in my projects. I have added the AFNetworking to my project. I have also added 'SystemConfiguration' and 'MobileCoreServices' framework to the project. I have included the framework header files in the .pch file like below
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "AFNetworking.h"
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
When I try to run the project, I get Clang error from file AFHTTPClient as follows
Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 254

Ok , I solved the problem. The issue was with order of import statements in .pch file
I changed the order to as follows basically added 'AFNetworking.h' after import statements for and frameworks.
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import "AFNetworking.h"
Also another tip. You also need to add 'Security' framework for AFNetworking to work smoothly. Thanks

Related

I have a ios project in objective-c i got some errors like PubNub/PubNub.h' file not found and more files

I have a ios project in objective-c i got some errors like PubNub/PubNub.h' file not found and more files
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import "LoadingViewClass.h"
#import <PubNub/PubNub.h>
#import "BaseTabController.h"
#import "Constants.h"
#import "Reachability.h"
i have this all file but i got this error and i am new in ios development
thanks for help

GoogleAnalytics Cocoapod unresolved identifier 'GGLContext'

With the Google cocoapod now deprecated I have switched to using the GoogleAnalytics pod and amended my bridging header to import the following:
#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIEcommerceFields.h"
#import "GAIEcommerceProduct.h"
#import "GAIEcommerceProductAction.h"
#import "GAIEcommercePromotion.h"
#import "GAIFields.h"
#import "GAILogger.h"
#import "GAITrackedViewController.h"
#import "GAITracker.h"
Now my build keeps failing at:
GGLContext.sharedInstance().configureWithError(&configureError)
Can't find anything in the Google docs and Google searches have also proved fruitless.
A point in the right direction would be greatly appreciated, or even pointing out something painfully obvious that I'm missing.
This answer was the correct one, not the one marked as "correct" since it suggests to use deprecated version of libraries instead of moving on with the new versions and updating your project accordingly:
https://stackoverflow.com/a/46858690/3506788
If you use Firebase, make sure that you initialise Firebase before using this line:
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID

PFFacebookUtils.h (1.7.1) imports non-existent FacebookSDK.h

I've installed the Parse and Facebook iOS SDKs for my project in Xcode. My project is written in Swift so I have the following in my bridging header:
#import <Parse/Parse.h>
#import <ParseUI/ParseUI.h>
#import <ParseCrashReporting/ParseCrashReporting.h>
#import <Intercom/Intercom.h>
#import <ParseFacebookUtils/PFFacebookUtils.h>
When I build the app, I get 2 errors:
error: 'FacebookSDK/FacebookSDK.h' file not found
error: failed to import bridging header '/Users/ben/AppFolder/MyApp/Bridging-Header.h'
The bridging header is at the directory as shown, so it seems that is dependent on the first error. FacebookSDK.h is in an #import statement at the top of PFFacebookUtils.h:
#import <Foundation/Foundation.h>
#import <FacebookSDK/FacebookSDK.h>
#import <Parse/PFConstants.h>
#import <Parse/PFNullability.h>
#import <Parse/PFUser.h>
FacebookSDK.h does not exist in either the Parse iOS SDK 1.7.1 or the Facebook SDK (presumably 4.0.1) from Facebook's Getting Started page, though I know that FacebookSDK.h was in previous versions.
I tried the approved answer from this SO question without success. Do I need to add something to my bridging header? Should I change the import statement for FacebookSDK.h to reference a different file? Other ideas on how to fix this?
Instead of
#import <ParseFacebookUtils/PFFacebookUtils.h>
use :
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
Make sure to add that V4

Failing to import c-file in objective-c

I'm currently trying to compile my project just after adding some C code.
I'm using the Paul Kocher's blowfish algorithm implementation available on Bruce Schneier's website.
Since I included blowfish.c & blowfish.h in my workspace, my compiler is running crazy. Like if it did not recognize Objective-c code, pointing errors on NSObject class!
I tried to .mm the calling class but the problem stays.
Each answer found on SO talks about including C++ file, but it's not my pb...
Maybe a compiler directive that i'v missed ?
Most likely, what is happening is that the compilation of blowfish.c is using your previously established precompiled header (.pch) file, and that is including an Objective-C framework. Just disable the precompiled header and you should be OK. You might be able to conditionalize those frameworks, but personally, I find precompiled headers more trouble than they’re worth.
Thanks to microtherion, I found the problem.
My .pch file was declared as :
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
#import "AppDelegate.h"
#import "UINavigationController+Rotation.h"
#import "Categories.h"
The 3 last #import'ed files are objective-C.
I've just changed the #endif place to:
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "AppDelegate.h"
#import "UINavigationController+Rotation.h"
#import "Categories.h"
#endif

Prefix.pch not included at compilation time

I have defined many constants in GlobalVar.h and other .h files. I import these files in the Prefix.pch file like this :
//
// Prefix header for all source files of the 'XXX' target in the 'XXX' project
//
#import "GlobalVar.h"
[...]
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#endif
But when I compile the project all the #defined identifiers are missing and reported as "Use of undeclared identifier XXX".
I searched in the Build settings and the PCH file is set as "Prefix Header"... I am on Base SDK 4.3 and XCode 4.0.2
Do you have hints to debug this ?
Thanks for your help
I came across this error yet, after cleaning DerivedData and restart Xcode I fix it. Hope to help.
move your import to like so
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "GlobalVar.h"
#endif

Resources