Lexical or Preprocessor Issue With AFNetworking Framework - xcode

In a project that I have added AFNetworking to I keep getting the build errors as in the image below.
I have tried the usual deleting the build/ folder and restarting xcode, removing and re-adding the framework, cleaning and building. I also tried adding the following code to my Project-Prefix.pch file:
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
//START - ADDING IMPORT FOR ALL TARGETS DUE TO AFNETWORKING
#import <Cocoa/Cocoa.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
//END
#endif
But that doesn't seem to fix the issue either. I then tried removing AFNetworking from the project but it still gets this Lexical error when I try to build.
I've seen these compile errors before in XCode 4 and it was usually fixed by quitting xcode and deleting the build/ folder and then re-building the project. But this time it does not work.
I do not understand what the error refers to or how to fix it. It may not be caused by AFNetworking.
Can somebody help me figure this out?

Linker failed messages typically mean that you are missing some frameworks that your code references but that you have not added to the frameworks list.
You can add these frameworks in Xcode 5 by going to the File Navigator > Project > Build Phases > Link Binary with Libraries (then type in the missing library).

To fix this I had to edit the .pch file and add the following lines:
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#endif
There's no referenced to this in the error message that was displayed so it was confusing and took ages to figure out. Hope it helps point somebody else with similar issue in the correct direction to solve their issue.

Related

Adding Parse to iOS App Errors

I'm trying to incorporate Parse into my iOS app. After adding all the Frameworks and building the app I get several error messages none being related to the code itself.
I read somewhere that you need to add the Facebook SDK to your project and I did that but it only took away 3 of the errors. Does anybody know the proper instructions on installing the Facebook SDK to your project? Perhaps I didn't add it correctly?
Thanks.
Are you using Swift?
I had the same problem and it was because the frameworks are in Obj-C.
If that's the case, you need to add a bridge header file - here's a quick overview of how to do so: http://blog.parse.com/announcements/building-apps-with-parse-and-swift/
Here's the content of my bridge header file:
#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
#import <ParseUI/ParseUI.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>

Confusing xCode error

I'm getting a really confusing error, I've import a class with his header from other project, both files are exactly the same but in my new project is not working. Even when I try to replace isKindOfClass: by myself the method does not find any UIwhatever object. What am I missing?
You need to import:
#import <UIKit/UIKit.h>

Parse.com : installed latest SDK but now App not working

My IOS App. Twoater has been up and running successfully for a couple of months now.
I downloaded the latest SDK and implemented the parse.framework :
- deleted old framework from within xCode
- dropped new one into xCode
- checked parse.framework in Build Phases tab
All looks OK.
When I try to build the code I fails in 2 classes where I have the following statement relating to PFQueryTableViewController. See code
#import "AppDelegate.h"
#import <Parse/Parse.h>
#import <CoreLocation/CoreLocation.h>
#interface TwoatsTVC : PFQueryTableViewController
And get Error :
"Cannot find the interface declaration for 'PFQueryTableViewController' ... did you mean UITableViewController
Any ideas welcome ...
Many thanks,
Guy
Try importing the ParseUI framework that is included with the SDK.
-Michael

A page-turning interface for iOS apps in Leaves Github Project xCode

I'm trying to implement leaves project link is below:
https://github.com/brow/leaves
but there are serverl errors I couldn't find out the issues that why there are so many errors
So would anyone please help me how can i solve this problem
I don't know where I'm doing mistake, I download the zip file and then extract it and run the project that's it.
I'm attaching the screenshot of the errors as well.
You can see the errors in the screenshot.
Import QuarzCore and CoreGraphics frameworks to your project.
Add this your .h file of the class that causes the errors:
#import <QuartzCore/QuartzCore.h>

In Xcode #import not showing code completion when just added .h c header

I added a MyHeaders.h header file from 'c and c++' section of iOS in xcode to import all other .h files in it, like how OCMock.h is having like below. It just has those 5 imports ignoring comments.
#import "OCMockObject.h"
#import "OCMockRecorder.h"
#import "OCMConstraint.h"
#import "OCMArg.h"
#import "NSNotificationCenter+OCMAdditions.h"
When i tried to add sixth line with #import code completion is showing up with valid values. But when i tried to do the same on MyHeaders.h code completion is not helping. What i might have missed? Please asssist.
Figured out that it works as long as this .h file is imported somewhere. As soon as you remove that import it stops helping code completion to choose framework or .h in its own import.
Curious to understand why it is behaving this? If someone knew, please let me know.

Resources