How do I build frameworks in Xcode? - xcode

I'm trying to use the GData framework, so I downloaded it and it came as an Xcode project so I assumed I needed to build it. So I opened it up and and clicked run and it compiled fine, but where do I go to access the .framework it created? I'm new to frameworks and have only been using xcode for a month or two so you'll have to excuse my lack of knowledge about it.

The documentation will help you
Anyway, by default the target is GDataUnitTest, just change it to GDataFramework. Once you compile it you will find the framework in the folder of the XCode Project called target.

Related

SpeechToTextV1 - Missing required modules SSCZLib, SSCommonCrypto

I am working on XCode 9.1 project that uses IBM Watson swift-sdk SpeechToTextV1 package. After upgrading swift-sdk to the version 0.19.0 and building XCode project the compiler error has occured: Missing required modules: 'SSCZLib', 'SSCommonCrypto' pointing to the import SpeechToTextV1 statement. swift-sdk updated via Carthage.
Cartfile content: github "watson-developer-cloud/swift-sdk".
command line update: carthage update --platform ios --no-use-binaries.
How can I include SSCZLib and SSCommonCrypto modules into XCode project?
Please help. Thanks a lot.
Use carthage update --platform iOS --no-use-binaries. It takes a while, but it works.
I'm afraid that I haven't been able to replicate the problem on my machine. I started with a new, empty Xcode project and was able to transcribe audio with the Speech to Text service.
I uploaded my app here. Can you try downloading it, adding your Speech to Text credentials, and running the app?
Please make sure that the newly compiled frameworks are the ones being used. Carthage does not place the frameworks in a custom location that is referenced in the project or workspace.
For me - in addition to building the library using --no-use-binaries flag - I also had to ensure that under my target's
Build Phases->Embed Frameworks
Build Phases->Link Binary with Libraries
SpeechToTextV1.framework is included
In addition - I found that these two files made all the difference inside the Carthage folder:
Carthage/Checkouts/ios-sdk/Source/SupportingFiles/Dependencies/Starscream/zlib/include.h
Carthage/Checkouts/ios-sdk/Source/SupportingFiles/Dependencies/Starscream/zlib/module.modulemap
I could only get this to work after my project was directly referencing the Carthage folder. Deleting either of these two files caused the error to return.
The v0.21.0 release of the Watson Swift SDK fixes this issue. You should no longer have to add a link to the zlib folder in your project settings. However, you will need to copy Starscream.framework into your application in the same way that other frameworks are copied.
The solution was to externalize the Starscream dependency. Adding Starscream as a recursive dependency for the Swift SDK allows it to build independently with its own environment. When the Starscream library is copied into your application, it should automatically include the SSCZLib and SSCommonCrypto dependencies.
We test each SDK before it's release, but this problem slipped past us. Our test machine happens to have other software that adds SSCZLib and SSCommonCrypto to the path, making it available to the Xcode build. It wasn't until we refreshed the machine with a new macOS install that we were able to replicate the problem. And with v0.21.0, that problem has been solved.
Sorry for your trouble and thank you for your patience while we tracked down the solution!

Compiling Xcode project from zipped open-source GitHub download

Possibly basic question but I'm not sure where to begin for an answer. I am very much a newbie to Xcode, Cocoa, Swift and Objective-C.
I'm interested in developing an open-source Markdown editor for the Mac that will build from existing open-source code. I have gone to GitHub to download the source code for two existing projects, MacDown and WriteDown! For both projects I download the project .zip file (and am happy that the button to do so is now easily available), and extract the .zip file's contents on my hard drive. In each project there is an .xcodeproj file which I open up in Xcode... and I see tons of errors, mostly because of things that are missing, so I cannot build and run them.
With WriteDown I see "missing base SDK" (and get a corresponding error when I try to run it), and many other files missing (frameworks, products, and "pods"). With MacDown I get a lot of errors mentioning missing pod files.
If it were just the one project that gave me errors I would assume this was something specific to that project, but since they're both giving me errors it sure seems like I'm doing something wrong in general. Should I be downloading something other than the downloadable zip? Downloading extra frameworks? Taking an extra step in between?
I am using Xcode 6.1.1 on OS X 10.9.5, which MacDown seems to indicate it's compatible with.
Few things:
1) If an .xcworkspace is available, you should open that in lieu of the .xcproj. The workspace contains multiple projects that are important for the building of the application.
2)
Check out this answer for "Missing Base SDK" XCODE Base SDK Missing
3) Go to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs and check to make sure you have the proper system SDKs available
4) It looks like those projects also require CocoaPods, a OS X Dependency Manager. You need to download the "pods" AKA 3rd party dependencies in order to build the application

Error importing framework in Playground

I’m following the instructions for Importing Custom Frameworks into Playground, but I still keep getting "No such module” error.
I have tried adding everything in the workspace; a project with just Framework target, project of Cocoa Application with the framework, and just the Framework. I also tried creating a playground in the Application where I imported the framework, I can even import it in other swift file without any problem; but I can’t seem to be able to import it in playground.
Can someone please tell me what I might be doing wrong?
Try building your framework target using a simulator! I had only built mine using the generic device which doesn't work for playgrounds!
Did you ever get it to work? I figured out my issue. The code I was trying to import wasn't in a Framework Target. I had to add a new target to my project of type Cocoa Framework. Then include my source files in that framework, and then finally build that target. Then it worked.
I would like to echo what Reid said:
Try building your framework target using a simulator! I had only built mine using the generic device which doesn't work for playgrounds!
If you've updated to Xcode 12, you also need to make the "Build Active Scheme" box is checked. Select your playground and go to the inspector. The checkbox will be under "Playground Settings"
I've spent for this more than 4 hours. But i've solved it for XCode 10.
You're unable to add any framework into the Playground if there's no target for it the Workspace where the Playground is. So as you using downloaded framework (so am i) — you're doomed to fail with it.
The workable manual could be found here (God bless this guy): https://www.pardel.dev/blog/3rd-party-frameworks-in-xcode-playgrounds
tldr: the easiest way is to:
Download 3rd party framework sources.
Open *.xcodeproj
Add Playground to the Project.
Build project for any iOS simulator by cmd+b (have no idea how to use any macOS frameworks yet).
And it should work (at least it does for me).
I solved my problem with a different solution than Michael Welch's. I had my Xcode derived data setting different than original. Go to Preferences > Locations > Derived Data > Advanced and select Unique. This solved the framework not appearing in playground problem for me.

How to add Core Plot as static library to Mac app?

I am working on a Mac App project using Xcode 5.0.2. Currently Core Plot 1.1 is integrated in the project. I did this following the instructions on the Core Plot project page: The Core Plot source code is integrated in my project and compiles alongside with my app.
Since I switched from Xcode 4 to 5 I have trouble starting my app. The receipt validation code that runs at startup cannot verify the apps receipt any more. The console shows a hint that the app is not signed properly:
storeagent[329]: Unsigned app (/Users/MyUser/Library/Developer/Xcode/DerivedData/MyApp-gvgullbzaekzujejuhfssrnmmmit/Build/Products/Debug/MyApp.app).
I found a hint that there is a problem signing nested bundles like Core Plot when using Xcode 5 on Mavericks.
Because of this I would like to integrate Core Plot as static library instead of as nested bundle. However the instructions on the Core Plot page (see link above) only describes this option for iOS projects.
Is it possible to use Core Plot as static library in an Mac App project as well? What would be the necessary steps to do this?
You have probably figured out a way to do this already, but as I was struggling with the same thing myself and the steps, while simple, don't seem to be explained anywhere I thought I would do so as an answer here. As you mentioned, this is not explained on the CorePlot Mac Setup Page, so it may cause complications or become obsolete down the road, but it is working for me as of right now. Steps are:
Download the latest CorePlot release
Copy the file Binaries/MacOS/CorePlot.framework into your project (drag and drop or by using "Add files to ..."
Make sure you enable "Copy items into destination group's folder (if needed)"
Make sure the new framework is added to the applications target membership
Set up the framework to be copied during build
Under Build Phases, add a Copy Files phase if there is none
Change the destination to "frameworks"
Drag the CorePlot.framework file from the Project Navigator into the file list

Adding a Library to your build and link path in XCode

I am tryingo to build a GUI application using the JUCE framework on MAC OSX.
I have dowloaded all the API's and got a small hello World program running fine.
However, when I add files to my Xcode project I get compilation errors that say that the Juce library files don`t exist. I would like to know how to get the library API in the build and link path in XCode so that it finds the neccesary files for compilation.
What I would do on Visual Studio going to properties and adding aditional library dependencies, is what I need to do in XCode but I don't know how.
Any help greatly appreciated.
thanks.
Old question but maybe a useful answer in the future....
If you have the "Hello World" up and runnning, it should already be linked to the library. Are you using the introjucer? This should help get everything up and running for you. If you are, you need to add classes etc to the introjucer, as this sets up Xcode / VStudio for you. If not, (Presuming XCode 3 as you are using leopard) goto Xcode > Preferences. Scroll along to source trees, and add the path to the juce folder in there.

Resources