How to codesign and enable the hardened runtime for a 3rd-party CLI on Xcode? - objective-c

My project needs the Ghostscript to do lots of tasks, so I have added the gs CLI tool into my project resource. However when I tried to notarize the project application, Xcode shows me this:
I assume that might because the ghostscript portable CLI is a 3rd-party program from the internet and which doesn't have a codesign, also it has not been enabled the hardened runtime. On the latest MacOS Mojave I have to notarize applications to avoid the gatekeeper shows warnings during the user opens the DMG file. But it seems the notarizing is hard to pass if the application contains a 3rd-party CLI.
Is there a solution for this?

I found the solution finally. Sign the CLI this way:
codesign --force --options runtime --sign "Developer ID Application: COMPANYNAME" ./CLITool
Then I successfully archived the Application and uploaded to Apple to notarize.

The enable hardened runtime is achieved via --options runtime.
I found this guide to be very helpful with the notarization and code signing process for app distribution outside the mac store.
I had an issue with my app crashing after enabling hardened runtime for it tho. This comment and this other one helped me with my issue at the time.

Related

CocoaPods : cmd-line builds

It seems that in cmd-line builds, Pods don't get built automatically. Even when invoking xcodebuild to reference the workspace that declares how projects link to each other.
Is there a way to fix this, besides manually opening the project in Xcode and building?
I don't have any problem with such configuration: CocoaPods 0.28.0 and Xcode5 (+ Command-Line Tools) here and building using the Command-Line quite often (especially for Continuous Integration) without having any problem.
Neither with the Apple's xcodebuild command, nor with xctool (see also this NSHipster's article) when building my personnal project using Travis-CI either, everything works fine;
At work we have plenty of Xcode workspaces created using CocoaPods / pod install and we use Jenkins-CI to run xcodebuild to build them and no problem either.
Maybe you need to check a bit more about your configuration? Which CocoaPods & Xcode version, Which Command-Line Tools (xcode-select --print-path?), How is you Xcode configured (maybe you changed some of Xcode's default settings that broke it somehow)?
Tell us more about your specific configuration and the error/warning messages you got, because there should not be any problem.
Also make sure you have an up-to-date version of CocoaPods (some stuff were fixed some versions ago regarding Xcode5 and the new arm64 architecture, that broke implicit dependency detection in some cases)

Distributing TideSDK application

I recently finished an application based on Titanium, Javascript, HTML, CSS. I have only been a web designer to date so I have little experience in distributing applications. I was accustomed to the TiDev Community deploying app, which prepared the app for download and made it available for download at a given link.
But tidev community is no longer supported, so I use TideSDK Developer to package the app, which doesnt do all the hard work the other one did so nicely.
I am obviously a complete rookie to this.
Could anyone outline the steps I would need to take to go from the bundled application folder I have now (put together by TideSDK Developer), to a link that will allow customers to download and install the app or online? I know there is an issue with packaoging the app for platforms other than your own, and that appcelerator is working on a solution to this I think. I also realise I would probably have to pay to host the download online. Any guidance would be greatly appreciated.
You must use the tidebuilder.py script. to compile a installation package. To compile a binary for a Mac, you must run the script on a Mac, to compile a binary for windows, you must be on a windows box etc.
There is some documentation on how to use it here per platform. The command is very simple and works.
Once you have your application file (DMG for OSX or a MSI for Windows) then just distribute it however you see fit, email, putting it on your web server, whatever works for you.

How to Codesign Growl.framework for Sandboxed Mac App

I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error:
Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl.framework/Versions/A
./Growl.framework/Versions/A: replacing existing signature
./Growl.framework/Versions/A: object file format unrecognized, invalid, or unsuitable
I've tried re-downloading the framework, but with no luck. Anybody see what I'm doing wrong?
Really strange, I've managed to resign the framework like this:
codesign -fs "3rd Party Mac Developer Application: Future Simple" Growl.framework/Versions/A/Growl
Growl.framework/Versions/A/Growl: replacing existing signature
(BTW: I'm working with Xcode 4.3.1 and Growl 1.3.1)
I just spent the day working through the "bundle format unrecognized, invalid, or unsuitable" error when codesigning a framework. In my case I'm using XCode 4.6.1 and I was trying to code sign Qt frameworks.
First note that the Apple documentation (TN2206) explicitly states that you need to code sign the versioned framework directory, not the library executable.
This is discussed further here:
How do you codesign framework bundles for the Mac App Store?
So, based on that, the command line in Ash's original question is correct. However I was getting the same error.
I did get it working with that command line. Here are the things that I had to do:
Make sure that you're using the correct version of CODESIGN_ALLOCATE. This is discussed in many of the answers here: iPhone Codesign object file format invalid or unsuitable If you can get XCode to sign an app then you can find the CODESIGN_ALLOCATE path in the build log.
Make sure that the versioned directory (./Growl.framework/Versions/A in the question above) contains Resources/Info.plist and that there is a link from Versions/Current -> Versions/A and that there is a link Resources -> Versions/Current/Resources at the top level of the framework bundle. I found that I could not sign the versioned framework directory without the Versions/A/Resources/Info.plist being present. You can read more about the correct structure of a framework here and here, or just take a look at some system frameworks to get an understanding about how they're supposed to be structured.
Further to the previous point, make sure that your symlinks in your framework bundle are structured correctly (Current links to numbered version, top level links to Current) as shown in the Apple docs. This won't affect code signing but your App will be rejected if you don't get this right.
Make sure that CFBundleExecutable is set to the correct name (the executable name) in your framework's Info.plist
Would it be better if we shipped the sdk unsigned? It'd be a simple change, I'm hesitant to do so now since it's been like this for a little while.
It looks like the error might have been trying to sign a bundle that was already signed; I fixed the issue by downloading the Growl framework source and compiling it with my own signature instead.
If I find a better answer that will work for frameworks for which you don't have the ability to compile, I'll post it here.

How can I fix a missing mscorelib.dll error that occurs when trying to run a Mono for Android app?

In MonoDevelop when compiling and running an app developed for Android against the simulator, the app compiles then crashes immediately in the simulator with the following application output...
E/mono ( 225): The assembly mscorlib.dll was not found or could not be loaded.
E/mono ( 225): It should have been installed in the `/home/jon/Development/xamarin/mono/BUILD/armeabi/install/lib/mono/2.0/mscorlib.dll' directory.
Keep in mind that I'm not Jon so I don't even know where it's getting the /home/jon path configuration. Though I have found that path in other similar but ultimately unrelated searches on the internet so I imagine it's a path on some other devs machine.
mscorlib.dll is indeed on my machine. located here...
/Developer/MonoTouch/usr/lib/mono/2.1/
and here...
/Developer/MonoAndroid/usr/lib/mono/2.1/
I've tried targetting various Android SDK environments (currently 2.3 and the simulator is currently running under the 2.3 SDK environment as well).
I'm on Mac OSx 10.7.2. Using the latest version of MonoDevelop, Mono and Mono for Android. I've also got the latest MonoTouch installed as well and iPhone apps compile fine if that's worth anything.
The closest thing I can find to a hint at the issue is here...
http://phonicuk.com/Forums/ViewThread.aspx?tid=401
I've tried reinstalling Mono and Mono for Android but admittedly have not tried uninstalling in entirely before a reinstall. I've searched within files for the /home/jon path thinking that it must be a configuration somewhere but haven't been able to find it anywhere.
I found this... Mono return error: mono mscorlib.dll was not found
Along with a few other things that were sort of in the same vein, but ultimately nothing that seems to be a fix.
Any ideas?
Update: From the suggestions in jonp's answer below it indeed seems like the Mono.Android.DebugRuntime package is not installed. So far I've tried a couple of MonoAndroid reinstalls and have tried removing MonoAndroid entirely beforehand. I'm trying to figure out if there is a way to add the package manually, but I'm so new to this.
Another update: Not sure why I didn't try this already, but I created a HelloWorld MonoAndroid app and it works fine. The compilation took a while longer too for that one and I could see if was setting up the required packages, so there has to be an issue with the specific solution.
When you install a Debug build of your app on the device, three .apk files are installed:
Mono.Android.DebugRuntime, which contains libmonosgen-2.0.so, mscorlib.dll, etc.
Mono.Android.Plaltform.ApiLevel_N, which contains Mono.Android.dll for API level N.
Your application.
My guess is that the Mono.Android.DebugRuntime package has not been installed. To check this, run:
adb shell pm list packages | grep Mono.Android
I'm going to guess that it's missing. :-)
Next, why is it missing? When you Run the app within MonoDevelop, all required packages are checked for and installed. It seems rather odd that it wouldn't be. Is your device low on disk space?
adb shell df /data
How are you launching the emulator? If you're launching within MonoDevelop, there should be enough free space to install all of the above packages. However, if you launch it yourself, the default /data size is 64MB, which isn't enough to support a Debug build environment. Please launch the simulator from MonoDevelop and re-Run your app, or launch the emulator so that it has enough free space:
emulator -partition-size 512 -avd YOUR_AVD_NAME

Installing of Adobe Air file fails with "file damaged"

Adobe Air brings following exception:
The application could not be installed because the AIR file is
damaged. Try obtaining a new AIR file from the application author.
Please add the different reasons which may lead to this error.
We had the same error as this guy:
The file ~/.airappinstall contains the following error:
failed while unpackaging: [ErrorEvent type="error" bubbles=false
cancelable=false eventPhase=2 text="invalid package signature"
errorID=5022]
The actual reason was not a damaged file or something like this, but our machine had a date from the past, which was not valid for the given certificate. After correcting the date/time on the computer, the installation worked just fine.
Even I faced the same error=5022, after thinking a lot on this issue, I finally got the
solution for this problem. It is simple, before installing the air app set the correct Date & Time for the system, WALLA it installs smoothly.
No need of changing the png name or anything else.
I faced this problem yesterday because my antivirus (avast pro/silent mode) was blocking access to file until finishing scanning, looks like installer don't like to wait, so when I switched off silent mode I made antivirus ignore scanning the file and installation completed successfully.
I have a virtual drive mapped to S: so that paths are the same between my home computer and work computer. I was trying to install the AIR app from an S: path. I guess it did it like it. Moving app to my desktop and launching there, worked.
Make sure you are signing the Application distributable and distributing the certificate along with the .air file.
I ran into same problems and solved it this way.
I had this issue when using Flash Builder 4, but building a Flex 3 application.
Basically, the installed AIR SDK in the Flex 3 SDK folder was AIR 1.5.3 (if I remember correctly), but the Flex 4 SDK folder had the AIR 2.0 SDK files (I'm not completely what the problem was).
My solution was to download the AIR 2.0 SDK, and unzip it over the Flex 3 SDK folder. Once I did that, the installation file worked fine. There is actually an article on Adobe about overwriting the AIR SDK files this way, although it didn't mention anything about installations or Flash Builder 4.
Mine was failing because I had another app on my system with the same name. Not a version of the app, a completely different app--native, not AIR.
Once I removed that app it worked fine.
For odd installation errors, keep in mind that Chrome uses a version of Flash that does not support AIR badge installation.
I encountered this error when trying to install an AIR file from an external / network drive. Copied the file locally, and installation proceeded normally.