I am working with an app which is updated infrequently every few months. This time it was necessary to build with the SDK iOS 9.0. But when I want to build the app using XCode I got this error:
“This app is not allowed to query for scheme cydia”
BUT WHO THE HELL is Cydia? Because I never used Jailbroken devices I didn’t know that Cydia is the App Store alternative for jailbroken devices. My App uses Splunk MINT for monitoring and they call the scheme “cydia://” to check if a device is jailbroken, because most jailbroken devices have Cydia installed. Anyway. This was the message everything started with and finally led to a chain of updating different parts.
Uh. XCode 6 is out in the developer preview version and Apple introduced Swift on the WWDC. We all love CocoaPods, but how to use the Pods in a new Swift project?
Let’s start with a normal Podfile for a test project called ‘cocoapods-test’
platform :osx, '10.10'
link_with 'cocoapods-test', 'cocoapods-testTests'
pod 'RaptureXML'
As you can see, I link also the test-target in my Podfile, because I want the Pods to also be available there.
Now lets execute the beloved
pod install
Successful included Pods
But now? We have a pure Swift project here, so how to I use the Objective-C resources in my target? The solution is already mentioned in the official Swift guide:
Fill out an Objective-C bridging header if you need to access Objective-C code from the same app target in your Swift file.
We need a bridging header, which Xcode automatically creates when you want to add the first Objective-C file to a Swift project. So we just add a file called “dummy”. This file I will delete later.
Yes, we want an objective C file now
Then Xcode will ask
This is exactly what we want right now. A nice bridging header file.
This auto-generation will also add the corresponding path to this header file into our Build Settings.
Build Settings for the Bridging-Header file
Into this header file we can then add our wanted Objective C headers like e.g.
#import "RXMLElement.h"
We can the use this library in our Swift files like e.g.
var rootXML : RXMLElement! = RXMLElement.elementFromXMLData(data) as RXMLElement
I just had the problem, that I created a brand new project in Xcode and wanted to add CocoaPods to it. When I opened my newly created workspace I got the error:
Couldn’t load myproject.xcodeproj because it is already opened from another project or workspace
Only the Pods project was correctly listed in the workspace – myproject not. The solution was to close the project in Xcode and close Xcode before running