Post

Replies

Boosts

Views

Activity

Debugging a macOS IPS dump
I have a macOS application built via command line (xcodebuild) using Xcode 16.1. Developed on ARM but end user is on Intel (same macOS 15.1). App crashed and they sent me a .IPS dump. From what MacGPT tells me: Reading an IPS (Incident Processing System) file from a macOS crash report in Xcode isn’t as straightforward as with iOS device logs. I can open the dump using Console. I see the IPS dump is partially symbolicated. Line in the dump says: Meteorologist 0x103e0348f 0x103d88000 + 504975 Referencing this article: Adding identifiable symbol names to a crash report | Apple Developer Documentation I run this command and see the same UUID for x86_64 as in the dump. dwarfdump --uuid /Users/ed/meteorologist/trunk/Build/Meteorologist.xcarchive/dSYMs/Meteorologist.app.dSYM/Contents/Resources/DWARF/Meteorologist I run this command: atos -arch x86_64 -o /Users/ed/meteorologist/trunk/Build/Meteorologist.xcarchive/dSYMs/Meteorologist.app.dSYM/Contents/Resources/DWARF/Meteorologist -l 0x103d88000 0x103e0348f And it says: fg: no current job Suggestions for what I’m missing?
1
0
218
Nov ’24
dSYM using xcodebuild
I am building my macOS app for distribution outside the Mac App store using a shell script as shown below. When a user reports a crash, all I get is offsets and I can’t tell what is going on, where: Thread 3 Crashed: 0 Meteorologist 0x1026da778 0x10268c000 + 321400 1 Meteorologist 0x1026d6354 0x10268c000 + 303956 2 Meteorologist 0x1026d0a8c 0x10268c000 + 281228 3 Meteorologist 0x1026e8ae4 0x10268c000 + 379620 4 Meteorologist 0x1026f7501 0x10268c000 + 439553 5 Meteorologist 0x1026f6621 0x10268c000 + 435745 6 Meteorologist 0x1026f74f9 0x10268c000 + 439545 7 Meteorologist 0x1026f7509 0x10268c000 + 439561 If I understand correctly, I need to include a dSYM file in my executable. I have DWARF with dSYM File in my Build Options, Release value. I can see the dSYM in my .xcarchive file. How do I get it into my .app executable? I do include uploadSymbols=TRUE in my exportOptionsPlist file. If I manually copy the dSYM file, prior to the notarytool step, notarytool throws an error. If I insert the dSYM file after I notarize then it gets flagged when I open the app because it doesn't match what was notarized. #!/bin/bash #set -e #set -x TEMPLATE_DMG=dist/template.dmg # "working copy" names for the intermediate dmgs WC_DMG=wc.dmg WC_DIR=/Volumes/Meteorologist VERSION=`cat ../website/VERSION2` SOURCE_FILES="./Build/Release/Meteorologist.app ./dist/Readme.rtf" MASTER_DMG="./Build/Meteorologist-${VERSION}.dmg" # .altoolid = abc@icloud.com aka Developer Email # .altoolpw = abcd-efgh-ijkl-mnop aka App-specific password # .altooltm = ABCD123456 aka Team ID dev_account=$(cat ~/.altoolid) dev_passwd=$(cat ~/.altoolpw) dev_teamid=$(cat ~/.altooltm) mkdir ./Build rm -rf ./Build/* echo echo ........................ echo "------------------------ Storing Credentials -----------------------" echo xcrun notarytool store-credentials --apple-id \"$dev_account\" --team-id \"$dev_teamid\" --password \"$dev_passwd\" notary-scriptingosx xcrun notarytool store-credentials --apple-id "$dev_account" --team-id="$dev_teamid" --password "$dev_passwd" notary-scriptingosx > xcodebuild.log exit_status=$? if [ "${exit_status}" != "0" ] then cat xcodebuild.log exit 1 fi rm xcodebuild.log echo echo ........................ echo "------------------------ Building Project as an Archive -----------------------" echo xcodebuild -project Meteorologist.xcodeproj -scheme Meteorologist -configuration Release -derivedDataPath ./Build -allowProvisioningUpdates --options=runtime clean archive -archivePath ./Build/Meteorologist.xcarchive xcodebuild -project Meteorologist.xcodeproj -scheme Meteorologist -configuration Release -derivedDataPath ./Build -allowProvisioningUpdates --options=runtime clean archive -archivePath ./Build/Meteorologist.xcarchive > xcodebuild.log exit_status=$? if [ "${exit_status}" != "0" ] then cat xcodebuild.log exit 1 fi rm xcodebuild.log echo echo ........................ echo "------------------------ Creating exportOptions.plist -----------------------" echo \<?xml version=\"1.0\" encoding=\"UTF-8\"?\> > exportOptions.plist echo \<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\> >> exportOptions.plist echo \<plist version=\"1.0\"\> >> exportOptions.plist echo \<dict\> >> exportOptions.plist echo \<key\>destination\</key\> >> exportOptions.plist echo \<string\>export\</string\> >> exportOptions.plist echo \<key\>signingStyle\</key\> >> exportOptions.plist echo \<string\>automatic\</string\> >> exportOptions.plist echo \<key\>method\</key\> >> exportOptions.plist echo \<string\>developer-id\</string\> >> exportOptions.plist echo \<key\>uploadSymbols\</key\> >> exportOptions.plist echo \<true/\> >> exportOptions.plist echo \</dict\> >> exportOptions.plist echo \</plist\> >> exportOptions.plist echo echo ........................ echo "------------------------ Exporting the Archive -----------------------" echo xcodebuild -exportArchive -archivePath ./Build/Meteorologist.xcarchive -exportOptionsPlist exportOptions.plist -exportPath ./Build/Release xcodebuild -exportArchive -archivePath ./Build/Meteorologist.xcarchive -exportOptionsPlist exportOptions.plist -exportPath ./Build/Release > xcodebuild.log exit_status=$? if [ "${exit_status}" != "0" ] then cat xcodebuild.log exit 1 fi rm xcodebuild.log echo echo ........................ echo "------------------------ Compressing the app -----------------------" echo /usr/bin/ditto -c -k --keepParent ./Build/Release/Meteorologist.app ./Build/Release/Meteorologist.zip /usr/bin/ditto -c -k --keepParent ./Build/Release/Meteorologist.app ./Build/Release/Meteorologist.zip if [ "${exit_status}" != "0" ] then echo "Compress (ditto) failed" exit 1 fi echo echo ........................ echo "------------------------ Notarizing the app -----------------------" echo xcrun notarytool submit ./Build/Release/Meteorologist.zip --keychain-profile=notary-scriptingosx --wait xcrun notarytool submit ./Build/Release/Meteorologist.zip --keychain-profile=notary-scriptingosx --wait if [ "${exit_status}" != "0" ] then echo "xcrun notarytool failed" exit 1 fi echo echo ........................ echo "------------------------ Stapling the app -----------------------" echo xcrun stapler staple "./Build/Release/Meteorologist.app" xcrun stapler staple "./Build/Release/Meteorologist.app" if [ "${exit_status}" != "0" ] then echo "xcrun stapler failed" exit 1 fi echo rm ./Build/Release/Meteorologist.zip
2
0
2.5k
Aug ’23
Synchronous reverseGeocodeLocation
I'm using Xcode 14.3.1 I’m working on a macOS app that needs reverse geolocation. I have the following code: let thisLocation = CLLocation(latitude: lat, longitude: long) let geocoder = CLGeocoder() geocoder.reverseGeocodeLocation(thisLocation, completionHandler: { placeMarks, error in myLocality = (placeMarks?.first?.locality ?? "") + ", " + (placeMarks?.first?.administrativeArea ?? "") }) The geocoder.reverseGeocodeLocation call gets flagged with: Consider using asynchronous alternative function First off, it is async. myLocality doesn’t get filled in until long after the call has been issued. The use of a completitionHandler guarantees that. I tried an alternative geocoder.reverseGeocodeLocation call that really claims to be async, https://developer.apple.com/documentation/corelocation/clgeocoder/1423621-reversegeocodelocation. (This same page claims the call above is synchronous but with a completion handler. To me that’s an oxymoron, a completion handle by definition is not synchronous, https://developer.apple.com/documentation/swift/calling-objective-c-apis-asynchronously) Replacement code: let thisLocation = CLLocation(latitude: lat, longitude: long) let geocoder = CLGeocoder() let locationSemaphore = DispatchSemaphore(value: 0) Task { do { let placemark = try await geocoder.reverseGeocodeLocation(thisLocation) myLocality = (placemark.first?.locality ?? "") + ", " + (placemark.first?.administrativeArea ?? "") } catch { print(“Unable to Find Address for Location " + String(lat) + "," + String(long)) } locationSemaphore.signal() } // Task locationSemaphore.wait() In this second case, the semaphore.wait() call gets flagged the message: Instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6 Speaking from testing, the wait simply never gets resolved. I will add that my reverseGeocodeLocation call is nested in another async call. I guarantee that this is my max depth of 2. My semaphore logic works elsewhere in the code creating the first async call. My main question is how can I get the reverseGeocodeLocation synchronously, before moving on? How can I get a Task handle to wait on? Thanks all.
0
0
898
Aug ’23
Hardened Runtime for distribution outside the Mac App store
I am working on an open source weather app for distribution outside the Mac App store: https://sourceforge.net/projects/heat-meteo The project builds and runs fine in Xcode. The batch build script was using ALTOOL which can’t/shouldn’t be used anymore. I am trying to set it up for notarytool. This is what I think is now happening. Again, all works fine in the Xcode debugger. In Xcode, the build is setup with Automatically manage signing for both Debug and Release. They are using my Apple Development account, 4V7…. What I have read if that if I want to distribute outside of the Mac App store, it must be signed with my Developer ID Application, 7VN…. I tried to do an xcodebuild then codesign to switch from 4V7 to 7VN. That actually worked. codesign -dv --verbose=4 shows the correct account. However when I do that, codesign --display --verbose shows I lost the hardened runtime and then notarytool fails because hardened runtime isn’t set. The hardened runtime flag IS set before the codesign command. I can physically turn off Automatically manage signing in Xcode for Release, but how to I select my Developer ID Application account? It does not appear to be a choice. If it matters, the application needs both WeatherKit and Location entitlements and they are set to YES in the entitlements file. I’m guessing, and this pure guessing, I need to adjust something in https://developer.apple.com/account but I don’t know what. Thanks in advance.

Ed
25
0
3.2k
Apr ’23
weatherKit and macOS 12
I work on an open source Mac app that uses multiple weather sources. I've added weatherKit to replace Dark Sky. I got past my signing issues (https://developer.apple.com/forums/thread/722378) but when I try to run on macOS 10.15 (I know weatherKit won't work) but it won't even launch. The actual Swift code for weatherKit is wrapped with if #available(macOS 13.0, *) I don't expect the weatherKit code to work before 13 but I would like the same code to run by selecting another weather source. The deployment target in Build Settings is set to macOS 10.15 along with the Minimum Deployment. Of course the app is signed for weatherKit. Is there another setting I need to get the code to run (without weatherKit support) on older OS's or are multiple versions now going to be required. Thanks. Ed
3
0
898
Jan ’23
Notarytool, WeatherKit and a non App Store app
I work on an open source weather app for macOS. I would like to sign it for distribution. I used to do this with a shell script using xcodebuild, codesign and altool using this process: https://scriptingosx.com/2019/09/notarize-a-command-line-tool Obviously I now need to convert to use notarytool. I use the following steps: xcrun notarytool store-credentials xcodebuild -with -authenticationKeyID and -allowProvisioningUpdates xcrun codesign -s "$dev_teamid" --entitlements codesign -dv --verbose=4 /usr/bin/ditto -c -k --keepParent xcrun notarytool submit --wait --keychain-profile xcrun notarytool log xcrun stapler staple I ran with the credentials for Developer ID Application: (not Apple Development Certificate) All steps seem to run fine. The notarytool log shows: "statusSummary": "Ready for distribution” Yet when I try to run I get the message The application can’t be opened. When I click on the ? in the upper right corner, I get an empty window that pops up. Combing through the Console, these two messages jump out: Checking profile: Mac Team Provisioning Profile: com.heat.Meteorologist com.heat.Meteorologist: Unsatisfied entitlements: com.apple.developer.weatherkit What step have I missed? Thank you.
2
0
1.1k
Dec ’22
WEATHERKIT - hourly forecast
I'm using the following code to access WeatherKit. All services (except for .hourly) are working. For .hourly, the time blocks are 243 hours starting at 10pm, regardless of the time of time the request is made. What am I doing wrong? let weather = try await weatherService.weather(for: thisLocation, including: .daily, .hourly, .current, .alerts) // 0, 1, 2, 3 is the order of the "including" above let dailyForecast = weather.0.forecast let hourlyForecast = weather.1.forecast let currentWeather = weather.2 var alertWeather = [WeatherAlert]() if (weather.3 != nil) { alertWeather = weather.3! }
1
0
1.4k
Dec ’22