Hi,
I have create a universal app then did this:
https://support.apple.com/en-vn/guide/apple-business-essentials/axm20c32e0c6/web
But this doesn't produce a working package installer.
productbuild --sign "3rd Party Mac Developer Installer: ****" --component /Applications/MyApp.app MyApp-universal.pkg
Do I need to create a code signature with codesign, prior to call productbuild?
regards, Joël
General
RSS for tagDemystify code signing and its importance in app development. Get help troubleshooting code signing issues and ensure your app is properly signed for distribution.
Post
Replies
Boosts
Views
Activity
Following the description from https://developer.apple.com/documentation/xcode/embedding-a-helper-tool-in-a-sandboxed-app*
I successfully managed to run my app sandboxed on my development system. Nevertheless the copied application refuses to call the external tool unless it is compiled with NO for the App Sandbox entitlement.
My app can be downloaded from: https://github.com/mac-curver/Postscript-Playground
The last commit is using the App Sandbox entitlement but the commit before is not using it like compiled and zipped app in the Application folder on Github.
The attached picture shows, running the sandboxed app on my development machine. Why the sandboxed does not run on other MACs? How could I test this?
*P.S. I could not exactly execute all tasks as written in *, for example I require OS 13.0 and I am using a non commercial dev account (not paying for it).
For some years I have developed and maintained a SwiftUI based app as GUI ontop of the command line tool rsync. The app is available on HomeBrew and works as expected, included using rsync command line tool from HomeBrew.
I have now developed a new GUI, a downscale version of the original app, using SwiftData and using only the default rsync in /usr/bin/rsync. No access to remote servers by ssh-keys, only local attached disk on your Mac. SwiftData is used for storing data about synchronise tasks and log records from run.
The app works, but as soon as I enable the App Sandbox, the app does not permit to executed default included command line tool from /usr/bin. The GUI app executes the command line tool by a Swift Process object.
I want to develop a very basic app for my wife. Since I'm into Windows and Android, I don't have any experience with MacOS.
My wife is visually impaired and chose for an iPhone, and never switched since. I want to buy a cheap second hand MacBook Pro 2011 to be able to compile.
Found this one online. Is it good enough? It doesn't matter if it's slow or has some weird glitches. Only thing I want is develop the app, install it, and then let the MacBook rest for the rest of its live (sorry for this sad story MacBook-lovers :))
[Image Edited by Moderator to Remove Serial Number]
We are using an iPhone app distributed as an AdHoc app, but an error message saying "App cannot be verified" was displayed.
The error screen says, "Internet connection is required to verify the credibility of developer "Apple Distribution:●●●● CO.,LTD.(QQQ29B8GG2)"."
When using this app, We are connected to the LAN, but not connected to the Internet.
If you temporarily connect to the Internet and start the app when the error screen appears, the error screen will disappear.
After that, when I switched from connecting to the Internet to connecting to LAN, it worked normally for a while, but after about 2 months, the same error screen appears again.
Please tell me how to resolve this error.
My sandboxed macOS app requires the user to grant permission under Privacy & Security / Accessibility in order to support extra functionality. If no permission is granted the app can still be used albeit with very basic functionality.
In order to allow the user NOT to have to immediately decide whether to grant this permission when first launching the app, a dialog allows them to say “I’ll do it later”.
As such, the app uses a timer with a one second interval to ask the system if permission has been granted and if so, implements the extra functionality. By the way, I would rather have used a notification instead of a timer, but there does not seem to be one.
// Schedule a timer to periodically check accessibility status
accessibilityTimer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(checkAccessibilityStatus), userInfo: nil, repeats: true)
func isAccessibilityEnabled() -> Bool {
let accessibilityEnabled = AXIsProcessTrusted()
return accessibilityEnabled
}
@objc func checkAccessibilityStatus() {
if isAccessibilityEnabled() {
print("Accessibility is enabled.")
accessibilityTimer?.invalidate()
if gEventTap == nil {
tapper()//as003
gTypeIt4MeMenu?.item(at: kPauseResumeItem)?.title = "Pause"
gStatusItem?.button!.image = NSImage(named: "menubar_icon_16x16")
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "showGreenTick"), object: nil)
}
} else {
print("Accessibility is disabled.")
}
}
My problem is that when I build the app with my development certificate, it runs as expected.
However, when I upload it to TextFlight and download from there, it no longer “notices” when I grant it permission.
Both the codesign tool and Xcode allow you to sign code with a hardware-based code-signing identity. However, setting that up can be a bit of a challenge. Recently a developer open a DTS tech support incident requesting help with this, and so I thought I’d post my instructions here for the benefit of all.
If you have any questions or comments about this, please start a new thread, tagging it with Code Signing so that I see it.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Signing code with a hardware-based code-signing identity
Both the codesign tool and Xcode allow you to sign code with a hardware-based code-signing identity. This post explains how to set that up.
I used macOS 14.2.1 with Xcode 15.2. For my hardware-based key I used a YubiKey 5 NFC that I reset to its defaults. I installed YubiKey Manager 1.2.5.
IMPORTANT While I used a YubiKey, the code signing parts of this process should work with any token that has a functioning CryptoTokenKit driver.
In the case of the YubiKey, it presents a PIV interface and thus it’s supported by macOS’s built-in PIV CryptoTokenKit driver.
In this example I created an Apple Development certificate because those are dime a dozen. This process should work with any other type of code-signing certificate. Indeed, it make sense to store your most precious keys in a hardware token, including your Developer ID keys. For more on that topic, see The Care and Feeding of Developer ID.
Generate a certificate signing request
To generate a certificate signing request (CSR):
Connect the YubiKey via USB.
Dismiss any system alerts:
If the “Allow this accessory to connect?” alert comes up, click Allow.
If the Keyboard Setup Assistant comes up, quit that.
If the ctkbind notification comes up, dismiss that. Coded signing does not require that you bind your login account to your hardware token.
Launch YubiKey Manager.
Choose Applications > PIV.
Click Configure Certificates.
Select Digital Signature (slot 9c). In the past I’ve run into situations where signing fails if you don’t use this slot, although I haven’t tested that in this particular case.
Click Generate.
Select Certificate Signing Request (CSR) and click Next.
Select the RSA2048 algorithm and click Next.
Enter a subject and click Next. The value you use here doesn’t matter because Apple ignores pretty much everything in the CSR except the public key.
Click Generate.
Choose a save location and name. Don’t include a file name extension.
When prompted for the management key, enter that and click OK.
When prompted for the PIN, enter that and click OK.
The app will generate a .csr file at your chosen location.
Quit YubiKey Manager.
Note Apple typically uses the .certSigningRequest extension for CSRs, but this process works just fine with the .csr extension used by YubiKey Manager.
Generate a certificate from your CSR
To generate a certificate from that CSR:
In Safari, go to Developer > Account and log in.
If you’re a member of multiple teams, make sure you have the correct one selected at the top right.
Click Certificates.
Click the add (+) button to create a new certificate.
Select Apple Development and click Continue.
Click Choose File, select your CSR file, and click Upload.
Click Continue to generate your certificate.
That takes you to the Download Your Certificate page. Click Download.
In Terminal, calculate a SHA-1 hash of your .cer file.
% shasum "development.cer"
840f40ef6b10bedfb2315ac49e07f7e6508a1680 development.cer
Import the certificate to form a code-signing identity
To import this certificate into your YubiKey:
Convert the certificate to PEM form:
% openssl x509 -in "development.cer" -inform der -out "development.pem"
Launch YubiKey Manager.
Choose Applications > PIV.
Click Configure Certificates.
Select Digital Signature (slot 9c).
Click Import.
In the file dialog, select the PEM and click Import.
When prompted for the management key, enter that and click OK. The UI updates to show the certificate issuer (Apple Worldwide Developer Relations Certificate Authority) and subject (Apple Development: UUU, where UUU identifies you).
Quit YubiKey Manager.
Unplug the YubiKey and then plug it back in.
Sign a test program
Before digging into Xcode, check that you can sign code with the codesign tool:
Create a small program to test with. In my case I decided to re-sign the built-in true command-line tool:
% cp "/usr/bin/true" "MyTool"
% codesign -s - -f "MyTool"
Run codesign to sign your program, passing in the SHA-1 hash of the certificate you imported into the YubiKey:
% codesign -s 840f40ef6b10bedfb2315ac49e07f7e6508a1680 -f "MyTool"
When prompted for the PIN, enter that and click OK. The codesign invocation completes like so:
% codesign -s 840f40ef6b10bedfb2315ac49e07f7e6508a1680 -f "MyTool"
MyTool: replacing existing signature
Sign from Xcode
To sign from Xcode:
Open your project in Xcode. In my case I created a new project by choosing File > New then selecting macOS > Command Line tool.
In Signing & Capabilities for the tool target, turn off “Automatically manage signing”.
In Build Settings, find the Code Signing Identity build setting, choose Other, and then enter the SHA-1 hash of your certificate.
Choose Product > Build.
When prompted for the PIN, enter that and click OK. The build then completes.
IMPORTANT This requires Xcode 13 or later. Earlier versions of Xcode only work with file-based code-signing identities.
Hi team
We are facing following message "A timestamp was expected but was not found" during codesign for following .pkg file and it cause Jenkins NB process failed.
We are facing this issue for last 3 days as it was working on last 18th January.
Kindly let us know how to fix this problem.
Rgds
Hello
I jump on my mac every 3-4 months to release new version of my apps. Process usually is "ok" some cmake/compile issues as 99% of dev is done on windows but other than that its all good.
But now I'm stuck.
My app can run locally/start etc just fine, but clients are panicking because they can't run them. They have undefined developer warning.
I don't understand this. Its notarised and been working for 2 years. What am I doing wrong ?!
How can I test it ? I tried creating new user-profile on my mac, but there is no issue, app starts. Do I need to buy ANOTHER mac to test my apps before release ?!
Can any1 help how to debug this issue? I'm lost,
I used finder-compress myapp.app & send it via slack to client to get him quickly going but that does not help either. - I though it was zip stripping down data or something.
Anyway, very frustrated here, and lost. Can any1 help? hint?
Is this good resource to check against?
https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html
I've run spctl --assess --type execute myApp and I'm getting rejected (bundle format is ambiguous (could be app or framework))
But then why does it notarize/sign/etc with no errors ?!
I'm so lost :- ((((
Any help would be greatly appreciated
I've attached app content >
Ok I've tested my older releases, they all have the same issue but they all work on client system. I'm so lost :- (((
Hi,
I've ran into an issue which only seems to affect one of my macs.
It's currently running 14.2.1 but I first saw this issue in 13.6.
If I download the macOS Sonoma 14.2.1 installer (via App store) onto this particular machine, it will never execute the installer. It always reports that the installer is "damaged". Of course I did reasearch this online and you get the usual unhelpful posts which just say "re download it" and of course, I wouldn't be posting here had I not tried that.
This happens with any macOS installer I download using the softwareupdate --fetch-full-installer utility as well. The thing is, if I copy this .app to another (identical as far as I can tell) Mac - it will work. So far this also seems limited to macOS installers - other third party apps are fine. I'm convinced this is related to trusted execution and something has gone wrong in the environment. I've been looking at my router logs to see if any connections may have been blocked (I'm using OPNsense) and also looking to see what connections are being made via Little Snitch and so far it looks fine. Again, other machines on the network can run these just fine.
I've read through eskimo's excellent guide here: https://forums.developer.apple.com/forums/thread/706442 but I was wondering if anyone can give me some pointers to narrow this down further.
As it stands, I can't trust this machine for app development if I can't even get the official Apple installers to run sucessfully.
Two days ago everything was working fine. Then I decided to step on with the OneSignal Sdk and the problems starts to come.
Now I have two big problem but I want to go with order and begin from the first and maybe the second will follow.
When I try the app on emulator, it builds fine but stopped immediately with
The parent bundle has the same identifier (com.domain.bundlename) as sub-bundle at /Users/myname/Library/Developer/CoreSimulator/Devices/F2D73A5F-1B86-4D2D-9989-518387D0FB24/data/Library/Caches/com.apple.mobile.installd.staging/temp.O4MORK/extracted/Runner.app/Frameworks/App.framework
(com.domain.bundlename is for obscuring the real ones)
Then I tried creating a new emulator device, but I got the same error.
No clues on my internet search.
I am looking for any help regarding an errSecInternalComponent error I am seeing when trying to archive my iOS app via my CI process. Specifically, this CI process is a GitHub Action running on a self-hosted M2 Pro Mini machine to which we have Screen Share access. I have followed the very helpful seminal post and have confirmed that I can run the necessary command in the local terminal via Screen Share, and I don't get any Keychain Access dialogs to pop up. When I try to run the same command via an SSH terminal from my local machine on that same machine, I get the following error:
/Users/{username}/Library/Developer/Xcode/DerivedData/{projectID}/Build/Intermediates.noindex/ArchiveIntermediates/{projectname}/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/{some name}NotificationServiceExtension.appex: errSecInternalComponent
I only get the error for that one service extension target. The project is only a couple years old, created with Xcode 14 or maybe 13. The signing has always been managed automatically with the provisioning profiles for all our targets being managed by Xcode.
Thanks in advance for any advice or suggestions as to what I may be missing or how to address this problem. I am more than happy to provide any more information I can to diagnose and solve the issue.
I'm working on an app using entitlements. The entitlements are setup in its code signature and they are also applied in the corresponding provisioning profile.
I embed said provisioning profile in the app, but when I launch the binary it gets rejected by taskgated-helper (as seen in console.app it says "profile not found").
However, if I install the same embedded provision profile it will work! So I can only assume taskgated-helper is not looking in the Contents/embedded.provisionprofile file when I try to run the binary?
I can only imagine that the issue revolves around the binary not being the main bundle binary in the application, as that one works just fine without installing the profile.
I would simply install the profile to fix the issue, but it brings other problems when trying to install the application in a headless environment (as opening the profile to install in system settings requires user interaction).
Any ideas?
I have an non-appstore application, using developer id which I want to transfer to another developer account.
How can I go about doing this?
How do I transfer the app ID?
Will past versions of that app signed with the old account continue to work? Will I have to re-sign them?
Is setting "Enable App Sandbox : Yes" required for distributing an app to the App Store?
I'm building my first app, a game, and can only test on my physical device with the Sandbox set to No. I can run it on the emulators with Sandboxing enabled.
I'm still using the free developer account and will be enrolling in the paid account once 2024 arrives.
Searching for insight on the best and most compliant way to essentially merge two apps. They have the same functionality but one is much more advanced than the other, although the legacy app has a higher user count. Instead of letting both run, we want to push the legacy app an update with the code from the new app and ultimately kill the newer one. What is the best way to do this? Is it allowed to simply push the source code from new app to legacy and update the identifier? We do not wan't to break any app store rules and want to limit the potential of losing users by forcing them to download a new app.
We have started creating third-party applications and for that we required to apple certificate and initially created multiple certificate (application and installer), later on realises that one can be enough to approve multiple application.
Now we are not seeing any option to remove or revoke the certificates so that we can create new certificate. Support team also not able to help on this.
What should we do to create new certificate?
I want to distribute my app with my developer ID.
This works fine in a dmg or zip container if I download it on another Mac by FTP.
But if I download it by HTTPS macOS brings a Popup:
“Rocrail.app” is damaged and can’t be opened. You should move it to the Bin.
I don't understand the diff between FTP and HTTPS download...
How can I fix this?
Hi,
We have an app that installs a number of system extensions. According to this documentation the app must be located in the Applications folder to be activated so when the app launches we check that it is running from /Applications (or a subfolder) and if it isn't we inform the user and exit. This has been working fine until a recent submission whereupon installing the app via TestFlight casuses it to be translocated when run and our check to fail. So, a couple of questions:
Is it expected that an app installed via TestFlight (or indeed the AppStore) can be translocated when it is run?
If yes to the above, how can we ensure that out app is running from Applications and can therefore activate its extensions?
Thanks
Alan
I'm trying to run an app that has a .dylib listed in the configuration of the application as "Embed & Sign"
I can confirm it is correctly signed by inspecting the package using codesign -dv --verbose=4 lib_paths.dylib and it gives me the following:
Executable=/Users/blablabla/Debug-iphoneos/TestApp.app/Frameworks/lib_paths.dylib
Identifier=lib_paths
Format=Mach-O thin (arm64)
CodeDirectory v=20400 size=784 flags=0x0(none) hashes=16+5 location=embedded
VersionPlatform=2
VersionMin=917504
VersionSDK=1049600
Hash type=sha256 size=32
CandidateCDHash sha256=7eaecbb8e00114767c9de0ac9054213620052212
CandidateCDHashFull sha256=7eaecbb8e00114767c9de0ac90542136200522121105dd217b38bd27e1fda4de
Hash choices=sha256
CMSDigest=7eaecbb8e00114767c9de0ac90542136200522121105dd217b38bd27e1fda4de
CMSDigestType=2
Executable Segment base=0
Executable Segment limit=32768
Executable Segment flags=0x0
Page size=4096
Launch Constraints:
None
CDHash=7eaecbb8e00114767c9de0ac9054213620052212
Signature size=4795
Authority=Apple Development: myemail@address.com (XXXXXXXXX)
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=13 Dec 2023 at 21:39:28
Info.plist=not bound
TeamIdentifier=XXXXXXXXXXX
Sealed Resources=none
Internal requirements count=1 size=180
But when trying to run the application, I am getting the following error:
Referenced from: '/private/var/containers/Bundle/Application/3142F1F2-547B-41B5-8EF4-239F4EAD2A4F/TestApp.app/FSVTestApp'
Reason: tried: '/usr/lib/system/introspection/lib_paths.dylib' (no such file),
'/usr/lib/swift/lib_paths.dylib' (no such file),
'/private/var/containers/Bundle/Application/3142F1F2-547B-41B5-8EF4-239F4EAD2A4F/TestApp.app/Frameworks/lib_paths.dylib' (code signature invalid (errno=1) sliceOffset=0x00000000, codeBlobOffset=0x0000C5E0, codeBlobSize=0x00004B50 for '/private/var/containers/Bundle/Application/3142F1F2-547B-41B5-8EF4-239F4EAD2A4F/TestApp.app/Frameworks/lib_paths.dylib'),
Note that I enabled the "Automatically manage signing" option, and using a Personal Team.
This seems to work fine for the application itself (otherwise it wouldnt even try to load the dylib).
What is going on ?