I'd like to give control to the app developer that uses my library to select which level of logs they'd like to see from my lib (e.g. do they want to see all debug messages or just errors).
I know there are filtering controls that Xcode gives us, but I'm wondering if there is a way to pull this off with code. Ideally the user callsite would look like MyLib(logLevel: .info).
And then I would pass that info level somehow to OSLog. Today, I create my logger like this:
let myLogger = Logger(
subsystem: Bundle.main.bundleIdentifier ?? "UnknownApp",
category: "MyLibrary"
)
As far as I can tell, there is nothing I can then pass to my myLogger instance to configure the threshold level. I'm imagining an interface like:
myLogger.logLevel(.warning)
// Later...
myLogger.debug("You won't see this")
myLogger.error("But you will see this")
Does OSLog and friends give us any ability to do this out of the box, or are we building little wrappers around OSLog to accomplish this?
Thank you,
Lou
General
RSS for tagDive into the vast array of tools and services available to developers.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi, We are seeing the below error in our angular application where we use the custom elements. Can you please help us to resolve the issue?
[Error] TypeError: new.target does not define a custom element.
The same code works fine in other browsers.
Topic:
Developer Tools & Services
SubTopic:
General
I am working on a Swift package which uses CoreAudio, and includes some tests in a testTarget which use the Testing framework, and a couple of executableTarget targets which exercise the same code. I'm using Xcode 16.2 on macOS 15.3.1.
One of the things I do in the test code is create a HAL plugin, then find that plugin using the kAudioHardwarePropertyTranslateUIDToDevice.
Finding the plugin that I just created always fails from within a Swift Testing test, unless I run the test which creates the plugin individually first, then separately, run the test which finds the plugin, by clicking on the little arrows next to the function names.
If I put the tests in a serialized suite (so creation always happens first, then finding), running the suite always fails - it creates the plugin, but can't find it. If I run the 'find my plugin' test again manually, it is always found.
If I call the same functions from a regular executable (the thing created by a "executableTarget" in my .package.swift file), the just-created plugin is always found.
Is there a way to mimic the runtime environment of a regular executable in a Swift Testing target, or am I misunderstanding something?
this my be related to this issue: https://github.com/swiftlang/swift/issues/76882 but I don't understand it well enough to be sure.
Is anyone seeing flaky results when using parameterized test with pairs of (input, result) data?
I have several (5) tests for a given method. I create a zip sequence by zip([in1, in2, in3, in4, in5],[out1, out2, out3, out4, out5])
Sometimes, the test only runs 4 of the tests and fails to report a failure even though I deliberately place data that should cause a failure.
Sometimes, even though I only select one test to run, the test explorer goes crazy into a loop and I have to clear test results to get it to stop. Following a suggestion, I disabled running tests in parallel.
Xcode 16.2 / OSX 14.7 (Sonoma) / Mac mini M2 Pro
This morning I installed podman on my new Apple laptop. It can be inited successfully but failed to start.
The error is: Error: Error Domain=VZErrorDomain Code=1 Description="Internal Virtualization error. The virtual machine failed to start." UserInfo={
NSLocalizedFailure = "Internal Virtualization error.";
NSLocalizedFailureReason = "The virtual machine failed to start.";
My new Mac laptop with the latest OS version: 15.3.1 and it is Apple M4 chip.
I verified that my Virtualization.framework is good by ls -l /System/Library/Frameworks/Virtualization.framework also my MacOS support virtualization because sysctl kern.hv_support returns kern.hv_support: 1.
I tried to install it on my old Apple laptop which is intel core, same OS version - everything is good.
How to fix this issue?
I work at a well-established university with a business journal that is over 25 years old. We have been waiting now for almost four months to have our Apple News account reviewed. In what world is this OK? No ability to communicate with anyone or have any updates except to log in once a month to see the 'under review' message still there. Seriously?
I am using Swift Testing for TDD my project. I have a struct that contains an array of 65536 UInt8's along with other properties. I am testing methods that modify the properties of the struct including the contents of the array.
In just one of my test files, any test fails (there are several in the file), the entire contents of the struct, including the array, are printed to the console. In another test file they are not. I'm don't think there are any differences to the test setup in the two files. Any idea what's going on?
I'm able get the program to skip the dump to the console by copying the properties I want to test to local let constants and testing those.
Thanks
Hello,
There seems to be a regression with macOS SDK 15 and dynamically loading libraries if Address Sanitizer is turned on. Seems to only affect Debug builds, and .frameworks. I've also reported this via the Feedback Assistant: FB16513866
Here's a minimal repro, if anyone is interested: https://gist.github.com/peter-esik/6b00432e411be85333e14ae7d953966e
I thought I'd post this here, as according to my web searches, this isn't a very well-known bug at this point.
My load average on a largely idle system is around 22, going up to 70 or so periodically; SSMenuAgent seems to be consuming lots of CPU (and, looking at spindump, it certainly seems busy), but... it's not happening on any other system whose screens I am observing. (Er, I know about load average limitations, the process is also consuming 70-98% CPU according to both top and Activity Monitor.)
Since this machine (although idle) has our network extension, I'm trying to figure out if this is due to that, or of this is generally expected. Anyone?
Topic:
Developer Tools & Services
SubTopic:
General
I'm calling this command to export archive:
xcodebuild -exportArchive -archivePath .build/XYZ.xcarchive -exportPath .build/XYZ.ipa -exportOptionsPlist Authenticator/ExportOptions.plist -quiet -allowProvisioningUpdates
Here is my exportOptions file content
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store-connect</string>
<key>signingStyle</key>
<string>automatic</string>
<key>teamID</key>
<string>ABCD</string>
</dict>
</plist>
Most of the time this command fail with this error:
error: exportArchive No Accounts
error: exportArchive No signing certificate "iOS Distribution" found
What we found is that our Apple ID just disappear from Xcode and we need to add it again manually.
So there are two questions here:
Why Apple ID account dissapears and how I can fix this?
Is there an option to not use Apple ID account in Xcode and for example to use -authenticationKeyID flags of xcodebuild?
Just to mention this happens only on our CI machine and not locally.
Crash dump:
`Crashed Thread: 0 tid_103 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGILL)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000016d3bfea0
Exception Codes: 0x0000000000000002, 0x000000016d3bfea0
Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4
Terminating Process: Unity [7873]
VM Region Info: 0x16d3bfea0 is in 0x169bbc000-0x16d3c0000; bytes after start: 58736288 bytes before end: 351
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
mapped file 169b00000-169ba8000 [ 672K] rw-/rwx SM=PRV Object_id=4d22156e
GAP OF 0x14000 BYTES
---> STACK GUARD 169bbc000-16d3c0000 [ 56.0M] ---/rwx SM=NUL stack guard for thread 0
Stack 16d3c0000-16dbbc000 [ 8176K] rw-/rwx SM=SHM thread 0
Thread 0 Crashed:: tid_103 Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x1932ee7ac _platform_memset + 108
1 libmonobdwgc-2.0.dylib 0x33977abdc GC_clear_stack_inner + 60
2 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
3 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
4 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
5 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
6 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
7 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
8 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
9 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
10 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
11 libmonobdwgc-2.0.dylib 0x33977abf8 GC_clear_stack_inner + 88
12 libmonobdwgc-2.0.dylib 0x33976b518 GC_clear_stack + 76
13 libmonobdwgc-2.0.dylib 0x33973c074 mono_gc_alloc_obj + 112
14 libmonobdwgc-2.0.dylib 0x3396e0db4 mono_object_new_specific_checked + 72
15 libmonobdwgc-2.0.dylib 0x3396e116c ves_icall_object_new_specific + 28`
Question:
I have created a workspace containing a SwiftUI app and two frameworks:
B Framework: Handles UI components
C Framework: Handles service classes
I added a Podfile to manage dependencies. My Podfile is structured as follows:
inhibit_all_warnings!
workspace 'ABC.xcworkspace'
def shared_pods
# Shared pods here
pod 'Alamofire'
end
target 'A' do
use_frameworks!
project 'A/A.xcodeproj'
shared_pods
end
target 'B' do
use_frameworks!
project 'B/B.xcodeproj'
shared_pods
end
target 'C' do
use_frameworks!
project 'C/C.xcodeproj'
shared_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
After installing pods and building the project, everything works fine except for Xcode’s SwiftUI Preview, which crashes with the following error:
xcpreviewagent crashed because Alamofire.framework is missing
Question:
How can I resolve this issue and make SwiftUI Previews work without Xcode crashing?
What happen when a deprecated method is used in project submitted to Apple Store Connect ?
Generally the Apple documentation give the alternative like "Use ***: instead" but sometime the documentation do not suggest anything.
What to do when a such Warning happen ?
Hello everybody!
I would like some help to resolve the error "/usr/bin/openssl" x509 -noout.
I've tried different ways but it persists.
I'm using Delphi (Embarcadero) version 12, I've also tried with 11 and without success.
I use MacMini version 15.2.
What could be causing this error
Thank you in advance
Topic:
Developer Tools & Services
SubTopic:
General
Windows 10 使用 VirtualBox 创建的 Monterey 12.6.7 macOS 虚拟机不能识别到 iPhone 7 手机。
iPhone 7 已经连接到电脑主机 (win 10) 的 USB 3.0 口子,手机已经信任电脑。
在 win 10,我看到了 “此电脑\Apple iPhone”,就是说,宿主机识别到了 手机。
现在,开启macOS 虚拟机,虚拟机右下角的 usb 图标,显示并且勾选到了 "Apple Inc. iPhone [0901]",但虚拟机还是没看到手机设备,导致 Xcode 也看不到手机设备。
虚拟机运行后,插拔 iPhone 7 手机,通过
sudo log show --predicate 'eventMessage contains "usbmuxd"' --info
看到了报错信息:
2025-02-13 10:31:06.541201+0800 0xa3c Error 0x0 0 0 kernel: (Sandbox) 1 duplicate report for System Policy: usbmuxd(22583) deny(1) file-write-mode /private/var/db/lockdown
2025-02-13 10:31:07.090321+0800 0xf807 Error 0x0 140 0 sandboxd: [com.apple.sandbox.reporting:violation] System Policy: usbmuxd(22583) deny(1) file-write-mode /private/var/db/lockdown
Violation: deny(1) file-write-mode /private/var/db/lockdown
Process: usbmuxd [22583]
Path: /usr/local/sbin/usbmuxd
Load Address: 0x10564b000
Identifier: usbmuxd
Version: ??? (???)
Code Type: x86_64 (Native)
Parent Process: sudo [22582]
Responsible: /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
User ID: 0
Date/Time: 2025-02-13 10:31:06.793 GMT+8
OS Version: macOS 12.6.7 (21G651)
Release Type: User
Report Version: 8
MetaData: {"vnode-type":"DIRECTORY","hardlinked":false,"pid":22583,"process":"usbmuxd","primary-filter-value":"/private/var/db/lockdown","platform-policy":true,"binary-in-trust-cache":false,"path":"/private/var/db/lockdown","primary-filter":"path","action":"deny","matched-extension":false,"process-path":"/usr/local/sbin/usbmuxd","file-flags":0,"responsible-process-path":"/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal","flags":21,"platform-binary":false,"rdev":0,"summary":"deny(1) file-write-mode /private/var/db/lockdown","target":"/private/var/db/lockdown","mount-flags":76582912,"profile":"platform","matched-user-intent-extension":false,"apple-internal":false,"storage-class":"Lockdown","platform_binary":"no","operation":"file-write-mode","profile-flags":0,"normalized_target":["private","var","db","lockdown"],"file-mode":448,"errno":1,"build":"macOS 12.6.7 (21G651)","policy-description":"System Policy","responsible-process-signing-id":"com.apple.Terminal","hardware":"Mac","uid":0,"release-type":"User"}
Thread 0 (id: 63477):
0 libsystem_kernel.dylib 0x00007ff80d8368ae __chmod + 10
1 usbmuxd 0x000000010565584e main + 3582 (main.c:816)
2 dyld 0x0000000114e3f52e start + 462
Binary Images:
0x10564b000 - 0x10565afff usbmuxd (0) <0fc9b657-d311-38b5-bf02-e294b175a615> /usr/local/sbin/usbmuxd
0x114e3a000 - 0x114ea3567 dyld (960) <2517e9fe-884a-3855-8532-92bffba3f81c> /usr/lib/dyld
0x7ff80d832000 - 0x7ff80d869fff libsystem_kernel.dylib (8020.240.18.701.6) /usr/lib/system/libsystem_kernel.dylib
2025-02-13 10:35:39.751714+0800 0x27f Default 0x0 0 0 kernel: (Sandbox) Sandbox: usbmuxd(119) allow iokit-get-properties kCDCDoNotMatchThisDevice
2025-02-13 10:35:45.025063+0800 0x27f Default 0x0 0 0 kernel: (Sandbox) Sandbox: usbmuxd(119) allow iokit-get-properties kCDCDoNotMatchThisDevice
Hello, my app has a custom font for some UI elements. When building with XCODE to my local device, all works and looks great. When distributing with TestFlight, the font doesn't seem to apply!
Yes, I've included the .ttf in my Development assets, anyone else having this issue with the TestFlight Distribution of their app?
How do I download the iPad Air (5th generation) 18.3 simulator? I activated my Mac and only have version 18.2 available.
I need to test the simulator that they are testing, but I can't because I don't have version 18.3 available. I only have the iPad version 18.2 available and the application works fine on that version.
I have already added logs in different parts of the application, but in the files that you shared with me no log appears. The macOS operating system is macOS Drought.
Topic:
Developer Tools & Services
SubTopic:
General
Hi! I wanted to use Lottie in my swiftpm app, but I've been running into errors and I'm not sure if it's possible. When I try to run the app, it crashes and I get errors saying that the library isn't loaded and the files aren't found (basically these: https://github.com/lottie-react-native/lottie-react-native/issues/373 , https://github.com/airbnb/lottie-ios/issues/2233 ). But moving the framework file into the PackageFrameworks folder doesn't work, and also I'm getting the error that swiftpm cannot distribute packages containing binary frameworks and from what I understand that just isn't something that swiftpm can do. So I was wondering if anyone knows any workarounds to this, or if I should just ditch Lottie?
Any help or advice would be greatly appreciated!
Topic:
Developer Tools & Services
SubTopic:
General
Tags:
Swift Packages
Swift Student Challenge
Swift Playground
Visual Design
Recently we tried to update the plist.info file in one of our apps to specify an LSMinimumSystemVersion of 16.0 but when uploading this to App Store Connect using the Transporter app we received an error that this setting cannot be any higher than 15.2. Is there any way around this? Will this be changing soon?
Topic:
Developer Tools & Services
SubTopic:
General
The target was chosen as IPhone and IPad. I can also run this build on my IPad. The info.plist content of all our other applications is the same and there were no problems until today. I don't understand why it is being rejected now.