The instructions for installing the JSON Framework seem to be for older versions of Xcode. I'm relatively unfamiliar with Xcode and I can't figure out how to properly import the framework into my project. I selected all of the files in the "Classes" folder (JSON.h, NSObject+JSON.h, etc.) that comes in the download, dragged them into the main area of my project, and added #import <JSON/JSON.h> to my ViewController's .h and .m files, and I get a No such file or directory error for JSON/JSON.h
What am I doing incorrectly here?
If you’ve placed the files under the Classes group and haven’t taken any further action, they’re at the root of your project directory. As such, import it as
#import "JSON.h"
I think you're indicating that you're importing JSON.h from the JSON folder, and it sounds from your description you don't have those in a folder...
Related
I am following this tutorial for import socket.io to swift. http://socket.io/blog/socket-io-on-ios/
I did everything in the tutorial but I am getting this error:
Use of unresolved identifier 'SocketIOClient'
for this piece of code:
let socket = SocketIOClient(socketURL: "localhost:8900")
My structure:
How can I resolve this problem ?
make sure about 2 things:
select "create groups" not "create folder references"
copy items if needed
In the bridging-header.h change this #import "SocketRocket/SRWebSocket.h" to this:
#import <SocketRocket/SRWebSocket.h>
If it does not work just add:
#import "SRWebSocket.h"
Also rename yout bridging header to Ribony-Bridging-Header.h and add it your project's target settings (refer to your bridging header path not just copy "TicTacIOiOS/Bridging-Header.h" from the documentation for websockets).
Make sure when copying you actually are copying the files. Here's a screen shot showing what I mean.
Don't do this when copying files...
In this image the options "Copy items if needed is deselected"
But be sure to do this
Select the option "Copy items if needed"
Also be sure to build your project after importing into the Bridging Header file. Be sure if it is a framework to import like so
#import <Framework/Framework.h>
But if it is a stand alone .h file then import it like so
#import "MyClass.h"
UPDATE: I would also suggest having a look here to make sure you got the steps right - How to call Objective-C code from Swift
I'm running into a nasty issue trying to import a header from a project that is embedded in my main project. What is the proper way to import RKJSONParserJSONKit.h indicated below?
I'm trying :
#import "RestKit/Support/RKJSONParserJSONKit.h"
but Xcode cannot find that file.
Just do #import "RKJSONParserJSONKit.h", no need to include /ResKit/Support/
you have to import the JSONKit
#import <RestKit/JSONKit.h>
if you have a problem with importing it as above try to load the kit by
#import "RestKit/Code/Support/Parsers/JSON/RKJSONParserJSONKit.h"
but you should add a copy of the RKParser.h into your project
I ended up just copying the required files over from the sample project over to the main project. A very hasty choice, but spending hours debugging header search paths is not my favorite thing to do in Xcode :/
I have created one library with "Utility.h" file. I want to add that custom library to my another iPhone application. I have added the library to project "frameworks" and I have drag the library to "Library Search Path" it shows like "$(SRCROOT)/libUtility.a". I have imported the header file as #import "Utility.h". But I am getting below error message.
Utility.h No such file or directory.
Please any one help me to resolve this issues.
What is my mistake.
You have to drag the Utility.h file to your project as well along with your library.
I have following issue: I have an iPhone application which can be compiled using various color styles. So the goal is to have several build configurations with defined style, for instance COLOR_STYLE_BLACK. Style definition files should be placed under some subfolder in source tree, like, for example Classes/styles/black. Then, in App_Prefix.pch I'd like to #import files from respective subfolder, like following:
#ifdef `COLOR_STYLE_BLACK`
#import "styles/black/DefaultStyle.h"
#endif
But the issue is that I cannot make XCode to import files from subfolders. It seems XCode does not allows folder structures in project, or at least I cannot figure out how to do it.
When I add folders as folder references to the project, XCode copies them to the Rersources folder, but does not add them to Compile sources build phase and reports errors on missing files.
Thanks for any tip or advice on this.
Matthes
The bigger issue here is that you're hardcoding your theme in sourcecode.
Its only ever the most extreme customisation that should be done this way. Its sound advice that your theme should be in artwork and you should select it at runtime by varying the path you load the artwork from and such.
I'm referencing a static library.
I've dragged the library project into my app project and reference it relatively.
The .a file from the library is linked into my app target.
I've added a reference to the librarys .h files' folder via Header Search Paths in the app project.
Then I add an import in my apps .pch file to a particular .h file from the library.
I build and get this error:
some.h: No such file or directory
The project is given info on where to find .h files for the library. Why can't it see them?
Try with
#import <some.h>
instead of
#import "some.h"
I don't think so. I just got one set up today piecing it together from the links below. I didn't include any .h files in search paths. In fact the one tutorial told me to remove any existing search paths (but I had to add them back for another library). Hope this gets you on the right track.
http://www.clintharris.net/2009/iphone-app-shared-libraries/
http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html
http://blog.costan.us/2009/02/iphone-development-and-code-sharing.html