i want to use this header #import < AVFoundation/AVCaptureDevice.h > in theos tweak, but i get this error:
AVFoundation/AVCaptureDevice.h: not such file or directory
i also add the AVFoundation framework to the makefile.
if i do #import < AVFoundation/AVFoundation.h> work fine, but i need this header AVCaptureDevice.h
help!
EDIT: My apologies, I completely missed the lower part of your post for some reason.
Just import the whole AVFoundation framework. It will include the AVCaptureDevice header for you.
For Theos projects, you need to add the frameworks to your makefile.
Look for this line (if it doesn't exist, add it manually):
*YOUR_PROJECT_NAME*_FRAMEWORKS
There's where you add any public framework you want to use. Suppose your app is called "myVideo" and you want to add the AVFoundation framework, you would do this:
myVideo_FRAMEWORKS = AVFoundation
As an additional piece of info, if you wanted to add more frameworks you do this:
myVideo_FRAMEWORKS = AVFoundation UIKit
Related
You can't write to self.state in the subclass unless you import UIGestureRecognizerSubclass.h as indicated here.
In a Swift environment, I'm confused how I'd go about importing this. I tried import UIGestureRecognizerSubclass.h, and without the .h, but I still can't write to self.state.
How would I accomplish this?
The Swift equivalent is simply:
import UIKit.UIGestureRecognizerSubclass
That imports the appropriate header.
You need to have or create a -Bridging-Header.h file to import objc headers such as the one you want. The import line looks like this:
#import <UIKit/UIGestureRecognizerSubclass.h>
If you don't already have a bridge header file in your app, the easiest way to get one is to add an objc class to your project, and xcode will ask if you want one, then creates the file and ties it into the settings for you. You can then delete the objc class.
Everything in that header file is automatically made available to your Swift code, no need to add any import lines in your swift files.
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
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>
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.
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