I just added JSONModel to my projected, according to instructions:
Download the JSONModel repository as a zip file or clone it
Copy the JSONModel sub-folder into your Xcode project
Link your app to SystemConfiguration.framework
tried to build, and... build error!
"use of undeclared identifier UIApplication" build error (line 387)
How to solve it?
I found a solution in here :
To fix it I added this , just below #import "JSONHTTPClient.h" (in JSONHTTPClient.m):
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#import < UIKit/UIKit.h> //<-delete the space, I couldn't write it without
#endif
add #import UIKit; in JSONHTTPClient.h file
Related
I am updating our Cordova framework and I am stuck on getting a particular Objective-C plugin class to work.
In my old (un-updated) project everything works just fine. I have a BridgingHeader.h file, its properly referenced in the build settings. However in my new updated project it can no longer find only one Objective-C class (PushPlugin.m).
What's strange is its finding all other Objective-C classes just fine, its just the PushPlugin.m it can't find.
Here is my BridgingHeader:
#import <Cordova/CDV.h>
#import <objc/runtime.h>
#import <Parse/PFObject.h>
#import <Parse/PFSubclassing.h>
#import <Parse/Parse.h>
#import <objc/message.h>
#import "GPUImage.h"
#import "PushPlugin.h" // This one is not found
#import "CDVParsePlugin.h"
And when I try to use PushPlugin I get not found error:
//AppDelegate.swift
let pushHander:PushPlugin = getCommandInstance("PushPlugin") as! PushPlugin
// ERROR: PushPlugin not found
To be extra certain, the PushPlugin file is referenced in the Compile Sources. And my BridgingHeader is properly referenced in the build settings.
Do you have any idea why one specific Objective-C class is not being found?
Update
So to be clear, there is no error reporting the BridgingHeader file. Its only when I try to use the PushPlugin that I encounter the error (meaning its not importing properly).
As suggested I ran a commandline build I got a build failed with these reasons:
** BUILD FAILED **
The following build commands failed: CompileSwift normal arm64
/Users/user/Desktop/mobile-cordova-upgrade/app/platforms/ios/App/Classes/AppDelegate.swift
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)
I am getting a weird error on my application when trying to add an ObjC .h file to the bridging header. In particular, when I try to add the header for STXFeedPhotoCell.h, the project fails to compile with the following error (this error is displayed in STXFeedPhotoCell.h. Here is my bridging header:
#import "NetworkHelper.h"
#import "ArtistModel.h"
#import "UIImageView+Masking.h"
#import "CommentModel.h"
#import "LoginViewController.h"
#import "STXFeedPhotoCell.h"
And here is the error thrown:
/pathToProject/Helden der Volksmusik/STXDynamicTableView/Cells/STXFeedPhotoCell.h:12:9: 'NSDate+DateTools.h' file not found
Indeed, STXFeedPhotoCell.h, has an import statement for file NSDate+DateTools.h.
If I remove line #import "STXFeedPhotoCell.h" from the bridging header, then everything compiles fine.
Would appreciate any pointers on why the compiler is getting this error, or if there is a problem in the way these dependencies are being managed for swift (I am using cocoa pods with frameworks enabled).
To import DateTools and use it in Swift, you have to add this to your bridging file:
#import "DateTools/NSDate+DateTools.h"
I have a project setup using the UnitTest template provided by Apple. Too I added MagicalRecord to Prefix header. When I am running on the device and Simulator everything is working fine.
Except the Unit Tests, when I am compiling for the unit tests the build failed with the following command: 'CoreData+MagicalRecord.h' file not found . This happens in the prefix header.
prefix.pch
//
// Prefix header for all source files of the '123tv' target in the '123tv' project
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "Environments.h"
#import "CoreData+MagicalRecord.h"
#import "PBLog.h"
#endif
Has anyone an idea?
Make sure that the Header Search Paths is set up correctly for your test target.
I generally use CocoaPods which will automate this stuff for you
Try to run command (1) in terminal, then add import in step (2)
In your project directory
run pod update
You should now be able to add
#import <MagicalRecord/CoreData+MagicalRecord.h>
to any of your target's source files and begin using MagicalRecord!
I am using XCode 4.3 and trying to check if the user has internet connection
I am using the reachability functions that are provided by apple but when I create an instance using this line
Reachability *curReach= [Reachability reachabilityWithHostName:#"http://www.google.com"];
I get the following errors :
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in classfile.m
and
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have included reachability.h and .m and I included the following in my .h and my .m file :
#import <SystemConfiguration/SystemConfiguration.h>
#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
#include <netinet/in.h>
#import "Reachability.h"
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
any reason why I am getting this error?
You've possibly chopped the error message a little too tightly, but it looks like a link-time error warning you that the Reachability class isn't part of your final binary, despite the interface having been visible while building.
So either you're using a static library for the reachability code and have built it for ARM (ie, actual device deployment), or you've neglected to include Apple's Reachability.m in your target. Possibly the easiest way to check the latter is to enable the right panel, select Reachability.m and look for a suitable tick under the 'Target Membership' heading.
I get the following error in Xcode, when building project. Can someone help me fix it?
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
with this error:
Prefix.pch:6:38: error: Foundation/Foundation.h: No such file or directory
Prefix.pch:7:28: error: UIKit/UIKit.h: No such file or directory
Sounds like you're not linking against the frameworks correctly, or more likely aren't copying the headers somehow. Likely you accidentally changed the include path of the project.
You have to include the Frameworks:
UIKit.framework
Foundation.framework