File not found when trying to import a header file into the bridging header? - swift

I'm trying to import my speech recognition framework into my project. Sadly my project is in Swift and speech rec is in objc. I don't see a problem with this. I have created a bridging header file before importing the framework and compiled to make sure it has no errors. Then I dragged the framework into my project. Got a successful compile again. Now I type this in my header file:
#ifndef Bridging_Header_h
#define Bridging_Header_h
#import "SpeechKit/SpeechKit.h"
#endif
And then I get the error: "SpeechKit/SpeechKit.h" file not found
I have tried reimporting the framework. Deleting and making a new header file etc. Nothing seems to work. I don't get why it's not picking up the header files from the framework.
Does anyone have any ideas? All help would be greatly appreciated.
Thank you so much.

Try #import "SpeechKit.h" or #import <SpeechKit/SpeechKit.h> instead #import "SpeechKit/SpeechKit.h"

use #import <SpeechKit/SpeechKit.h> in bridging header and don't forget to place import SpeechKit in your swift file

Related

use swift file into Objective-C project

Can anyone tell me how can I use swift file into my objective-C project?
I have a swift file which inherits from UIViewController instead of NSObject. I am trying to use the swift file but I am not able to figure out how.
When I add my swift file into objective-C project, it usually asks to create a bridging header.
In that header file I am importing my swift file as -
#import "SlideController.swift"
and my bridging file name is objcToSwift-Bridging-Header.h
I read many answers which asks to import file
#import "MyProductModuleName-Swift.h"
into the .m file, but I can't find any such file in my project.
I also changed the defines module = YES as shown in another answer.
But still I am not able to access swift file.
What am I missing? Please tell me the right steps to figure it out.
After you created Bridging header.
Go to Build Setting =>Search for "Objective-C Bridging Header"
Just below you will find ""Objective-C Generated Interface Header Name" file
and import That file in your view controller.
ex.In my case: "Dauble-Swift.h"

ASIHTTPRequest import issue

I am trying to get up and running with ASIHTTPRequest. I have followed the instructions as per http://allseeing-i.com/ASIHTTPRequest/Setup-instructions, having added the classes to a new group called ASIHTTPRequest and added the binaries. However when I try to add the imports, I get import errors on the .m files:
#import "ASIAuthenticationDialog.h"
#import "ASIAuthenticationDialog.m"
#import "Reachability.h"
#import "Reachability.m"
Any help would be much appreciated, I am new to Objective-C.
You do not import .m files only header files .h

Trying to use the STHorizontalPicker Library from GitHub but getting multiple errors

I'm trying to use the open source STHorizontalPicker library to implement a horizontal picker to my project but when importing the .m and .h files from GitHub to my project I'm getting multiple errors when compiling.
Does it require any special implementation?
I'm simply copying the .h and .m and adding to the project. Error are like : property 'cornerRatius' cannot be found in forward class object 'CALayer'...
Do I have to import some class to those files ?
Thnaks in advice.
Do I have to import some class to those files?
Yes, you'll need Quartz.
#import <QuartzCore/QuartzCore.h>

Why is Foundation.h not imported in the standard Xcode templates?

I just noticed that when I create iPhone application using standard templates in Xcode (View Based Application, Window based application etc) the header files only import UIKit.h (and not Foundation.h). So if the Foundation.h file is not imported, how can one use Foundation classes like NSString, NSArray etc in the program ? Shouldn't it be throwing an error?
It is imported in the precompiled header file (extension .pch) in your project.
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
As to why UIKit.h appears to have two import lines per file since it also shows up above, though, I'm not too sure. It shouldn't matter anyway, as the second #import line won't cause UIKit to be included again if it's already included in the precompiled header file.
If you take a look at some of the individual UIKit headers, they import Foundation themselves. As BoltClock noted, it's also in the standard .pch
The reason that it can be put in all these places is mentioned in "The Objective-C Programming Language":
This directive is identical to #include, except that it makes sure that the same file is never included more than once. It’s therefore preferred and is used in place of #include in code examples throughout Objective-C–based documentation.
You want to make sure that every file that needs access to the symbols defined in Foundation has them. The reason it's repeated is that it helps with reading and understanding the code; it says "This code relies on the stuff that's in this header".
It looks like the template files are designed to work with or without precompiled headers, so they import the header files they use. If you create a subclass of NSObject the template file will import Foundation. If you create a subclass of a UIKit object the UIKit header will be imported.
OK, so why can you use Foundation classes like NSString when only UIKit is imported. Well nearly all of the UIKit headers import Foundation.h!
Hope this make sense.

iOS linking to "ABAddressBook.h"

So I suspect this to be a project problem as opposed to a code problem. I am still relatively new to xcode. I am trying to access the ABAddressBook libraries and have included them in the project alright.
![alt text][1][1]: http://i.stack.imgur.com/lBaW0.png
Now when I try to say import "ABAddressBook.h", it doesn't know what I am talking about. Is there anything else I need to do to get that set up? Thanks!
Try
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
You have to import two frameworks one is the
AddressBook and the other is AddressBookUI and then you have to import those files into your viewController subclass file and you are done