Go - How to link Go macOS binary in an Xcode project? - xcode

I'm completely new to macOS development, this might sound quite basic.
I need to distribute a Golang app for macOS.
I built the Go executable for macOS, the executable works fine on macOS.
I made its .app structure following this tutorial
But before distributing it, I need to do a few things like code signing & integrating Sparkle (for updates).
For that, I need to open this .app as a Xcode project. How do I do that ?
Xcode recognizes .xcodeproj extension
I created a sample Xcode Objective-C project but how do I get this project to run my executable/.app ?

You do not need to open the app as an Xcode project - that doesn't make sense as such and cannot be done, as the app is not an Xcode project.
I would suggest instead using the gon tool you can find here for code signing.
The easiest way to install it is usually through HomeBrew by running:
brew tap mitchellh/gon
brew install mitchellh/gon/gon
The above requires you to have HomeBrew installed in advance.
After installing, you create a config.json file as described on the gon GitHub page, and then run:
gon config.json
That will sign, zip, notarize and staple your application for you - creating a .dmg file for distribution.
In regards to Sparkle for easily updating your program, this is something you have to integrate into your Go program. You can find an example of how to do that here.
The example contains a simply Objective-C function sparkle_checkUpdates() that uses the Sparkle framework to invoke the updating mechanism. It also contains a Go function sparkle_checkUpdates() that use C imports to call that C function described before.
In your existing Go program, you just need to call that sparke_checkUpdates from somewhere when the user wants to check for updates.

Related

XCode - How to create bundled CLI tool application

I'm new to XCode, so maybe I'm missing something that is very easy, but how can I create a CLI tool with XCode and bundle it with a system extension I compiled?
I want to create a console app that is bundled with my system extension and install/uninstall it.
As I understand, the extension should reside in the Contents/Library/SystemExtensions of the application(info from here).
From what I've found, I succeeded only to make a GUI/UI app but not a CLI app that can bundle things inside it.

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

FANN Xcode code sign issue

My development environment is:
OSX Mavericks, Xcode 5 Cocoa mac application
I have been using FANN to train and run a ANN. It has worked so far and I have been able to train and run an ANN. I have even made a simple command line application to train ANNs using FANN. However I have run into a problem that may have to do with the way FANN is distributed.
I wanted to export and share the application I had made, so I archived the Xcode project. When I did this I made sure to copy libfann.2.2.0.dylib under Build phases, so the end user would have the library which is needed to use the FANN code in my app. However when I tried to save a developer ID sign application using Xcode it failed to code sign it. I can still save it without code signing it. The interesting thing is that if I remove libfann.2.2.0.dylib from the copying phase under Build phases, Xcode can successfully code sign the application and save it. However if I do this the resulting application is corrupt because it cannot find the FANN library.
I made libfann.2.2.0.dylib according to the instructions on http://leenissen.dk/fann/wp/help/installing-fann/.
I understand that this may not be a problem with FANN, but with Xcode. However I have other static libraries in the same project and FANN is the only one that is creating these issues, so I believe there is a high chance it has something to do with the FANN library. I am not an expert in code signing, but my guess is that there is a conflict between the way the FANN library is made using Cmake and code signing.
Thanks in advance.
I was able to find a solution after playing around with code signing.
I decided to try manually code signing my app with instructions from http://www.digicert.com/code-signing/mac-os-codesign-tool.htm. This did not work. However the code signing tool pointed me to a problem with libfann.2.2.0.dylib. So I checked if libfann.2.2.0.dylib was code signed and it was not. When I saw this I thought I would try code signing libfann.2.2.0.dylib with my developer ID and re-importing it into my project. This strategy worked and I was able to export a developer ID signed version of my application.

xcode version visible from the ipa

I have few versions of Xcode installed in my mac.
Lately I noticed that some of my code compiles and does what it should when built using xcode 4.6.3. But it does not behave as expected when built using xcode 4.4.1.
Question: Is it possible to know about the xcode version from the ipa (iOS application) itself?
Thanks and I shall really appreciate sharing your knowledge and thoughts on this.
If you can browse down to your Info.plist, there is a field called DTXcodeBuild and it will have a string value, like 4H1503. You can actually go to your xcode archive or .app and Open Package Contents, and then go to Products/Applications/YourApp.app and Open That package contents. The Info.plist should be in the root. That is where you'll find your DTXCodeBuild.
That is for an .app file. .IPA is a different though. It should be a binary. You could rename it to a .zip and look around, but chances are you won't find too much in there. Look at this thread discussing, ipa, renaming it, and the binary aspect of it:
https://discussions.apple.com/thread/4258197?start=0&tstart=0

Missing com.CorePlot.Framework.docset bundle for core-plot documentation install into xCode

I am very new to both Objective-C and iOS programming. I am working my way through creating some graphs using core-plot and want to access some documentation that might help explain the examples given.
The readme file says in order to install the documentation I must:
Quit Xcode
Copy the com.CorePlot.Framework.docset bundle into ~/Library/Developer/Shared/Documentation/DocSets/
Launch Xcode, and browse Core Plot documentation in the Documentation browser
This looks easy but I am having a problem locating the "CorePlot.Framework.docset" bundle. Perhaps I am missing something simple?
Thanks.
Are you using one of the release packages or building from source?
If you're using a release package without the installer, the docset is in "CorePlot x.x.x/Documentation" after unzipping the archive.
If you're using the installer, it should have placed the docset in the right place.
If you're building from source, follow the instructions here to install Doxygen and Graphviz. Open the CorePlot-CocoaTouch project and build the Documentation target. The build script will install the docset automatically.
Eric

Resources