I am trying to use the Stripe SDK in my iOS App but there seems to be a problem. Whenever I try to import it like this:
#import "Stripe.h"
I get the following error:
Stripe.h file not found
But I have the file as shown in the picture attached.
Since Stripe is a framework, you need to import like this.
#import <Stripe/Stripe.h>
In your Objective-C –> Swift Bridging Header you have to import the Objective-C file like the following:
#import "Stripe.h"
Hope that helps :)
Related
I have just started to use the openCV library and I am trying to get everything set up. I have a swift project and have dowloaded the framework through cocoa pods. I am trying to import the openCV framework in my objective-c file and I keep getting errors. This is my code and the following are the errors.
#import "OpenCVWrapper.h"
//this line causes the errors
#import <opencv2/opencv.hpp>
#implementation OpenCVWrapper
#end
Errors:
After a little digging, I finally found the solution:
Import any Apple headers AFTER those of OpenCV. So the code should look like this:
#import <opencv2/opencv.hpp>
#import "OpenCVWrapper.h"
You need to add Bridging Header file and import the objective c file in it. after creating a file you need to add the path of this file into Build settings of project Target. Find Bridging Header in build settings. please refer
https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
I have a problem with importing CommonCrypto/CommonCrypto or CommonCrypto/CommonDigest. I need a SHA256 for my Swift code.
I found CommonCrypto github site in Cocoapods.
https://github.com/AlanQuatermain/aqtoolkit
So I have downloaded the file from above.
But I'm getting errors about ARC (I have added Bridging-Header like other tutorials do.)
The header file's name is NSData+CommonCrypto.h and NSData+CommonCrypto.m.
It's not a CommonCrypto/CommonCrypto or CommonCrypto/CommonDigest
Where can I download and get the exact file CommonCrypto for SHA256?
No additional files are required. You need a bridging header first of all, which you already have but for those who don't the easiest way to achieve this is to add an Objective-C file to your project and to accept when it offers to create a bridging header. You can then either import the whole of CommonCrypto (thanks #zaph - see comments) to the bridging header:
#import <CommonCrypto/CommonCrypto.h>
Or the constituent parts:
#import <CommonCrypto/CommonCryptor.h>
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonHMAC.h>
#import <CommonCrypto/CommonKeyDerivation.h>
#import <CommonCrypto/CommonSymmetricKeywrap.h>
You can now use CommonCrypto in Swift. For example code see here.
Edit
In Xcode 10 a bridging header is no longer required to import CommonCrypto in Swift. You can simply use:
import CommonCrypto
In fact, you don't need to compile any file to using CommonCrypto, just import it in your project.
or using some wrapper in Swift, just like https://github.com/soffes/Crypto
Let's back to CommonCrypto file,Apple have released it's source code in https://opensource.apple.com/source/
I am getting the error 'No such module Parse' even though I have added all of the needed frameworks. I get this error when I try to import Parse at the top of my appdelegate or my viewcontroller.
Here is a screen shot:
I want wasnt able to use the downloadable pro from parse because it was outdated. My goal is to get rid of this error. Please describe your answer because I know that this answer can be complicated do I have to do something in my search paths? Once again here is my error: 'No such module Parse'. Thanks for the help I appreciate it very much you can also download the project at this link: https://www.dropbox.com/sh/wn7wamqdp4ty34h/AADxXGMByvvaUYfzsBZ2Ej1Oa?dl=0
Try to import it in the Bridging-Header.h like:
#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
Create Briding-Header.h
Create a new Objective-C File
Choose Create Bridging Header
You can also try this: terhechtes answer or B Ks answer
How did you import your Parse framework? Manually or through Cocoapods(recommended)? #JulianPomper's advice is correct so long as everything is set up properly, but you don't need to import Bolts.
I'm working on a swift project until i needed This "Analog Type Time Picker". I downloaded the repo and tried it using Xcode 6.4 and it works fine. But when I started to transfer it to my project, It ask me to create a Bridging-Header and I created one, Also I imported the .h file in the bridging header. My project can see the delegate method so I think its just fine. But the problem is, the variables on the .m file has an error like this:
But if you notice, The last UIButton don't have error. What do you think seems to be the problem?
Put #import <UIKit/UIKit.h> or #import UIKit; at the very top of the .h file where you get these errors
It clearly looks like you do not imported UIKit. Just add #import <UIKit/UIKit.h> or #import UIKit; to the top of your .h file.
Otherwise if you are using both combination (Objective-C & Swift) means you need to add bridging header.
I am new to iOs development and would like to implement Google Analytics (swift).
It appears there is some missing information on implementing Google Analytics in swift on Google's instruction page:
It seems the import statement above is incorrect, can anyone assist me with the missing/correct statement?
Exta Info:
I come from a Java background and IDEs I use import for you, so
please excuse my stupidity.
I have cocopods installed, and use other pods: Almofire, Fabric, swiftyJson etc
I am developing for iOs 8
Instructions above this, are clear and working. Installing the pods/config file etc
In your Objective-C bridging header file, You should import GA header files:
#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIEcommerceFields.h"
#import "GAIEcommerceProduct.h"
#import "GAIEcommerceProductAction.h"
#import "GAIEcommercePromotion.h"
#import "GAIFields.h"
#import "GAILogger.h"
#import "GAITrackedViewController.h"
#import "GAITracker.h"
I am not sure if I am missing some import.
If you look in your Pods folder in Xcode you can see the available pods there. Most of them usually have a file that contains all import statements for any files needed. In this case its the Analytics.h file in Pods/Google/Analytics/
I'm guessing that, to import this file in your bridging header (which I hope you have, if not let me know), you can use #import "Google/Analytics.h".
It also says a little bit lower on the page, to import the <Google/Analytics.h> to the header.