Objective C - Swift Bridging issue Xcode 6.3 -Screenshot provided- - ios

So, I found myself craving a framework to replicate iOS 6 folders animation. Luckily I found one called JWFolders, which is pretty neat and useful, but my problem is the following:
I am doing my program in Swift, in Xcode 6.3, I imported the header file to the bridging thingy in the swift compiler settings, and as long as I don't try to use anything from that framework, it doesn't complain, but as soon as I try to use it and compile I get the errors shown in the image below.
(even with a simple declaration like this)
var folder = JWFolders()

So, If anyone was wondering, I got it working. I contacted the developer and asked for help, and he nicely told me I was forgetting to add the source code files ".m" to the source compiling files.
After that it worked.

Related

Cannot find protocol declaration for *** in my 'MyApp-Swift.h'

I am working on a project that up to now, despite the mess, it was working ok. Today, believe it or not, I have been updating it to Swift 5.
The project has iOS and tvOS targets as well as frameworks, tests, and top selves extensions. The project also was started using Objective-C and over the years has become 90% Swift.
I am not sure at what point something went wrong but, when compiling, I get the following error for all my top self extensions (mostly all tvOS Targets).
I have found similar questions but I can't understand whats going on.
Any ideas?
You are probably missing an import StoreKit in the Swift files that define IAPHelper. Sometimes this gets imported transitively, and Swift doesn't necessarily need it, but the Swift bridging header does.
Ultimately you need to make sure there's an ObjC #import StoreKit; that is evaluated before this line of code.
First, I have to thank Rob for his tips. I wish he could get the points!
After troubleshooting with the tips provided:
Add StoreKit to your linked frameworks list. -> Didn't work
#import StoreKit; before #import <...-Swift.h> -> Showed error use of #import when modules are disabled
I also saw that "...-Swift.h" was only declared in the Build settings of my "...Topself" targets. Still quite unsure why as I would have thought the whole project still have ObjC dependencies... Still quite new to this challenge.
Furthermore, If I unfold the error I could see that there was some kind of error trying to find "...-Swift.h" file.
At this point, I remembered that I am using cocoapods (I don't like you, you don't like me relationship) and I hated to see the warning "...Overrides Enable modules (C - Objective-C)" so I set it to default for the whole project.
Turns out that that for all "...TopSelf" targets, the default value is NO.
By Overriding Enable modules (C - Objective-C) to YES, clean, and build, everything started working again.

No such module Parse using Swift in Xcode 7.1

There are several questions addressing this issue already, but all of them (I think) are in reference to earlier versions of Parse using an objective-C bridging header to connect the framework. I am using the latest version of Parse that has support for Swift directly, which is a different setup process.
I've downloaded and added Parse to Xcode in the Build Phases -> Link Binary With Libraries. The directions on their website are extremely straightforward...download the SDK, add it to Xcode, import it, and done.
Parse seems to be added properly everywhere it should be:
But alas, when I use import Parse, I get a no such module error. I've tried adding the framework search path $(PROJECT_DIR) under Build Settings both recursively and non-recursively, and a few other recommendations from the other questions addressing this issue, but with no luck.
I'm wondering if this could be an issue with Parse or the Xcode beta, since both are extremely new, but I'm assuming the error is on my end, just not exactly sure where to look since the quickstart guide on Parse.com seemed so simple.
Apparently if you drag the Parse library to the 'Link with Binary Libraries' section, you will continue to get this error.
You have to drag Parse to the project navigator for it to properly import.
Since it should work regardless of where you drag it into Xcode, it is possible this could be a problem with the Xcode 7.1 beta or the updated Parse API for Swift support. I'm not entirely sure, but either way, it's a really simple fix, so not a big deal.

Can't build Swift app including Objective-C Tesseract library

I am trying to utilize the features of Tesseract OCR for an iOS app, and cannot even seem to get it going. I have followed the installation instructions to the tee and have still been unable to get it built correctly.
I have used CocoaPods to integrate Tesseract into my project, and that seems to be working fine, but, I am unsure of exactly what to put into my bridging header. There are over 50 header files in the Tesseract portion of the project, and it doesn't seem like I should need to add each individually into the bridging header.
With copy and pasting the basic code from the instructions into my project, I get a few errors:
1) /Users/kade/Documents/tesseract/tesseract/ViewController.swift:19:30:
Type 'ViewController' does not conform to protocol 'G8TesseractDelegate'
corresponds with this line of code:
tesseract.delegate = self;
2) if I comment this line out, the build succeeds, but then breaks upon execution of the following line:
tesseract.charWhitelist = "01234567890";
I believe this to be a bridging header issue because I have imported a file and fixed a previous error, but I'm not sure which Objective-C header file will include all of them.
Rookie mistake, I just figured it out.
I needed to include: ", G8TesseractDelegate" at the class declaration.
Silly me!
I hope this helps anyone who may be experiencing something similar! :)

TBXML in an iOS 8 extension fails to build

In my iOS app I use TBXML for xml processing, it's not officially updated but it still working fine for me.
I'm trying to create a Today extension for iOS 8 and when I add TBXML as a Compile Source I get the following:
TBXML.h
Before adding the extension, I didn't have any build issue with TBXML.
Any ideas of how can I resolve this?
Thanks
Fixed by adding #import <Foundation/Foundation.h> at the beggining of TBXML.h.
Seems that when working with extension, this file is not imported or is imported later
I always want to know WHY. Why would it work before without the include of foundation and not now? What changed? So I dug a little deeper and found the answer: Prefix headers. Xcode 5 must had automatically added a prefix header as a convenience or something. And the new one doesn't. That old prefix header automatically included Foundation, Availability, and UIKit.
Who knows why they changed it. Maybe it has something to do with swift.
A more detailed answer is at: Unknown type name 'NSError' and others

Adding Chipmunk Files to XCode NSObjCRuntime NSZone Parse Issue

Im working on SpaceViking project from Ray Wenderlich's Cocos2D Book and the project has worked fine so far. Near the end we are told to add Chipmunk files to the Xcode project and compile & run to test everything is fine without adding any new code yet.
As soon as I do that I get many Parse Issue errors coming from NSZone, NSObject and NSObjCRuntime which I don't get otherwise.
Can anyone help me out on this one? It should be an error on some of the added files. How do I find which one and where the error is being generated so I can fix it?
I would check and make sure the added files are 'typed' correctly by Xcode. Make sure they are set to Objective-C, C++ or C (whatever is appropriate in this case). I used to get tons of errors when importing C files that were mistakenly recognized as Objective-C by Xcode. Just changing the file type would solve most of the compile errors. Just and idea.

Resources