I cannot my AirPods 3rd gen to my phone it won’t play videos or music when connected. Screen bugs out some times doesn’t see when I swipe. Too many bugs .
Instruments
RSS for tagInstruments is a performance-analysis and testing tool for iOS, iPadOS, watchOS, tvOS, and macOS apps.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Good afternoon)
I am doing one of the test projects to create a PKPASS and a server to update this file on the device, as well as sending PUSH-a. APN service is used with JWT Bearer token. The server is written in Java Springboot.
We try to send push notification, pkpass update happens, response from APN 200 OK. But there is no notification, can you please tell me why this is happening?
I am also sending you a sample request:
curl -v -X POST
-H "apns-push-type: alert"
-H "apns-id: 5af474c5-a212-42f3-9f99-70a9e587e1e2"
-H "apns-topic: pas.example225"
-H "apns-expiration: 0"
-H "authorization: bearer eyJraWQiOiJGQ0pQVFFMV1ZNIiwiYWxnIjoiRVMyNTYifQ.eyJpc3MiOiI2N0ZGUTY1TEQzIiwiaWF0IjoxNzMwMzY3NzQ4fQ.FGXSLCR6mxkQyi7bNliZKZbVdN3m0xQzFSMUDRFU4aAYIgsgflk5MDEkS9k5riMHp10wpr80b20uq9cuPnoQqw"
--data '{"aps":{"alert":{"title":"title","subtitle":"subtitle","body":"body"}}}' \
P.S. I checked JWT on the page: https://icloud.developer.apple.com JWT was built correctly.
Thank you for your reply)
Translated with DeepL.com (free version)
While I was recently profiling some code from a Swift library, I noticed that XCTest added in signposts for the measurement tests, which I found really helpful to "home in" on the code I wanted to profile digging around in the stack trace.
I tried to add my own signposts to provide just a bit of my own markers in there, but while it compiles and profiles equivalently, the signposts just aren't showing up. This is with Xcode 16.1, macOS Sequoia (15.1) and a swift library, using XCTest and profiling within one of the unit tests.
Is there something in this sequence that doesn't allow the library to set up signposts and have instruments collect them?
The flow I'm using:
import os
let subsystem = "MyLibrary"
class MyClass {
let logger: Logger = .init(subsystem: subsystem, category: "fastloop")
let signposter: OSSignposter
init() {
signposter = OSSignposter(logger: logger)
}
func goFast() {
let signpostId = signposter.makeSignpostID()
let state = signposter.beginInterval("tick", id: signpostId)
// ... do a bunch of work here - all synchronous
signposter.endInterval("tick", state)
}
}
Is there something I'm doing incorrectly in using this API, or not enabling to allow those signposts to be collected by the profiler?
I do see the signposts that XCTests injects into the system, just not any of the ones I'm creating.
I am running Xcode 16.1, macOS 15.1 , iOS 18.1, and I see the error when trying to run the Instruments Network Profile
I'm having an issue with my swiftui macOS application where it is continually consuming more memory over time and after a couple of hours will grind to a halt. I've watched a few videos now on how to use Xcode Memory Graph and Instruments to identify the source of a leak (I assume it is a leak). These videos all provide very obvious issues as examples but mine seems more elusive and I don't know how to identify which part of my code is the cause of the issue.
After running instruments I see the following but the leaked objects are not always consistent:
Xcode Memory Graph shows NSSet as the culprit which is shown under CoreFoundation (not my App). I really am a beginner here and because it's not showing me somewhere in my app that I can go and investigate I'm really stuck.
I'm unable to capture Bluetooth logs via PacketLogger from my iPhone 11 (iOS 18.2) and iPad Pro (iPadOS 17.5.1) with Mac mini M2 macOS 15.2 (24C101).
I've installed Bluetooth profile on both devices, restarted multiple times connected to the computer, it shows device as online, however PacketLogger captures nothing at all.
For test I've installed profile on macOS and PacketLogger captures everything as it should. I saw some posts here from earlier this year, that people were having similar problems with PacketLogger. Please suggest a solution or confirm that it is a known bug.
Topic:
Developer Tools & Services
SubTopic:
Instruments
Hi everyone,
(I am running on an M2 MacBook Pro 14 inch with 96 GB of memory)
I've been profiling with Instruments to find out why program suddenly goes from full CPU usage (all of my threads active and all cores working) to about 33% CPU usage. An Instruments system trace is showing me a massive performance cliff where I suddenly get taken off the performance cores and only run on efficiency cores. The performance cores are then occupied by "kernel.release.t6020". What is this thing?
I have kernel callstacks enabled but I only get the instruction pointer and have no symbols for any of those callstacks. I'm accustomed to Windows development where kernel symbols are available so you can see deeply into the kernel to know why you're spending time there (for example, semaphore wait or thread scheduling). Is there a way for me to get a similar level of information or kernel symbols so I can see what the kernel is doing?
Around the time I observe the performance cliff, I also noticed in the narrative view some of the preemptions are done "because thread was balanced off CPU i (P Core) to optimize the system's CPU performance". What does this mean? Have I begun to hit some sort of thermal limit?
Here are some example screenshots of what I am seeing in Instruments:
Topic:
Developer Tools & Services
SubTopic:
Instruments
I'm developing a library and using XCTest for unit tests. While trying to profile the test suite, I noticed that Instruments seems to report a leak every single time the async throwing setup function is called, no matter what.
For example,
This will report a leak:
final class LeakTests: XCTestCase {
override func setUp() async throws {
try await super.setUp()
}
func testLeak() async throws {
try await Task.sleep(nanoseconds: 5_000_000_000)
}
}
This will not report a leak:
final class LeakTests: XCTestCase {
// override func setUp() async throws {
// try await super.setUp()
// }
func testLeak() async throws {
try await Task.sleep(nanoseconds: 5_000_000_000)
}
}
Any ideas on why this might be happening, or should I just file a bug report? It makes it quite difficult to use the leak detection for unit tests, as it shows hundreds of leaks when the whole suite is ran.
I am a developer creating an app for iOS 16 and my app mysteriously started showing a blank screen during previews and the simulator. I profiled the app launch with Instruments, and the results said that dlopen was running on the main thread for the whole minutes of profiling:
Hi,
When I run the new Processor Trace instrument on a simple C or C++ console app, it hangs in "Analyzing - Transferring data" upon finishing the measurement.
When I run it without any other instrument, I get the error:
Failed to stop recording session: Data Providers emitted errors: CPUTrace
Any ideas what I could try, or how to get a more verbose log of this failure?
Best, Ronny
P.S.: I'm using a Macbook Pro M4 Pro 14". MacOs Version 15.4 Beta (24E5228e)
I am currently reviewing the tutorial documentation for the instruments. (Instruments Tutorials: https://developer.apple.com/tutorials/instruments/identifying-a-hang)
It seems very useful, so I want to follow the tutorials step by step.
However, I am having trouble downloading the sample project files; it appears that the 7z file is broken.
(https://developer.apple.com/instruments/tutorials/downloads/InitialVersion.7z)
Can anyone help me with how to download the project files properly?
As stated in the title.
I am running the following code.
Each time I perform an API call, I create a new instance of URLSession and use a background-configured session to allow background API calls.
`
Code being executed:
import Foundation
// Model definitions
struct RandomUserResponse: Codable {
let results: [RandomUser]
}
struct RandomUser: Codable {
let name: Name
let email: String
}
struct Name: Codable {
let first: String
let last: String
}
// Fetcher class
class RandomUserFetcher: NSObject, URLSessionDataDelegate {
private var receivedData = Data()
private var completion: ((RandomUser?) -> Void)?
private var session: URLSession!
func fetchRandomUserInBackground(completion: @escaping (RandomUser?) -> Void) {
self.completion = completion
let configuration = URLSessionConfiguration.background(withIdentifier: "com.example.randomuser.bg")
session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil)
let url = URL(string: "https://randomuser.me/api/" )!
let task = session.dataTask(with: url)
task.resume()
}
// Data received
func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
receivedData.append(data)
}
// Completion
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
defer { self.session.finishTasksAndInvalidate() }
guard error == nil else {
print("Error: \(error!)")
completion?(nil)
return
}
do {
let response = try JSONDecoder().decode(RandomUserResponse.self, from: receivedData)
completion?(response.results.first)
} catch {
print("Decoding error: \(error)")
completion?(nil)
}
}
}`
Called in viewDidLoad, etc.:
let fetcher = RandomUserFetcher()
fetcher.fetchRandomUserInBackground { user in
if let user = user {
print("Name: \(user.name.first) \(user.name.last), Email: \(user.email)")
} else {
print("Failed to fetch random user.")
}
}
In Instruments' Network instrument, I focus on my app's process, use 'Command + 3', and switch to 'List: URLSessionTasks'.
Even though didCompleteWithError is called and the API call fully completes, the Duration keeps increasing, and the Success column remains '-' (neither 'Yes' nor 'No').
For non-background URLSessions, the session shows up as 'unnamed session', but for background URLSessions, it appears as 'unnamed background session 1 (XXXXXX-XXXXXX-XXXXX)'.
Does this mean the session is not actually being completed?
I've checked Debug Memory Graph and confirmed there is no NSURLSession memory leak, but is it possible that the app is somehow still retaining session information internally?
I also suspect that Instruments may not be able to fully track background URLSession tasks.
I’m seeing inconsistent call stacks and usage percentages in the Time Profiler between two Instruments builds:
• Xcode 16.0’s Instruments Version 16.0 (16A242d)
• Xcode 16.3’s Instruments Version 16.0 (16E140)
When I open an old .trace file recorded with the 16A242d profiler in the newer 16E140 Instruments, the call trees and percentage breakdowns no longer match. It looks like the latest Instruments now exposes or collapses different frames (e.g. system libraries, inline code) by default.
I rely on these call stacks as a baseline to track performance regressions and verify optimizations over time. Unfortunately, every Xcode/Instruments update changes what I see, making it impossible to compare profiles across versions.
My questions:
Is there a way in Instruments 16.0 (16E140) to restore the exact call-tree view and percentage calculations that 16A242d produced?
Failing that, is there a recommended workflow or tool for capturing CPU profiles in a way that remains stable and comparable, regardless of Xcode or Instruments version?
Any guidance on achieving consistent, version-independent performance measurements would be greatly appreciated!
Hiya folks! I'm David and I work on rust-analyzer, which is a language server for Rust similar to sourcekit-lsp. I'm using the new Instruments profiling tooling functionality in Xcode 16.3 and Xcode 26 (Processor Trace and CPU Counters) to profile our trait solver/type checker. While I've been able to use the new CPU Counters instrument successfully (the CPU Bottleneck feature is incredible! Props to the team!), I've been unable to make use of the Processor Trace instrument.
Instruments gives me the error message "Processor Trace cannot profile this process without proper permissions". The diagnostic suggests adding the com.apple.security-get-task-allow entitlement to the code I'm trying to profile, or ensure that the build setting CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES is enabled in Xcode.
Unfortunately, I don't know how I can add that entitlement to a self-signed binary produced by Cargo and I'm not using Xcode for somewhat obvious reasons.
Here's some information about my setup:
Instruments Version 26.0 (17A5241e)
I'm on an 14" MacBook Pro with M4 Pro. It's running macOS Version 26.0 Beta (25A5295e).
I've enabled the "Processor Trace" feature in "Developer Tools" and even added the Instruments application to "Developer Tools".
As a last-ditch effort before posting this, I disabled SIP on my Mac. Didn't help.
To reproduce my issue:
Get Rust via https://rustup.rs/.
Clone rust-analyzer: git clone https://github.com/rust-lang/rust-analyzer.git.
cd rust-analyzer
Run cargo test --package hir-ty --lib --profile=dev-rel -- tests::incremental::add_struct_invalidates_trait_solve --exact --show-output. By default, this command will output a bunch of build progress with the output containing something like Running unittests src/lib.rs (target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe).
I take the absolute path of that hir_ty-$SOME-HASH string (in my case, it looks like /Users/dbarsky/Developer/rust-analyzer/target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe) and add it to the "Launch" profile. To the arguments section, I add --exact tests::incremental::add_struct_invalidates_trait_solve.
I then try to record/profile via Instruments, but then I get the error message I shared above.
Below is output of codesign -dvvv:
❯ codesign -dvvv target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe
Executable=/Users/dbarsky/Developer/rust-analyzer/target/dev-rel/deps/hir_ty-f1dbf1b1d36575fe
Identifier=hir_ty-f1dbf1b1d36575fe
Format=Mach-O thin (arm64)
CodeDirectory v=20400 size=140368 flags=0x20002(adhoc,linker-signed) hashes=4383+0 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=99e96c8622c7e20518617c66a7d4144dc0daef28
CandidateCDHashFull sha256=99e96c8622c7e20518617c66a7d4144dc0daef28f22fac013c28a784571ce1df
Hash choices=sha256
CMSDigest=99e96c8622c7e20518617c66a7d4144dc0daef28f22fac013c28a784571ce1df
CMSDigestType=2
CDHash=99e96c8622c7e20518617c66a7d4144dc0daef28
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements=none
Any tips would be welcome! Additionally—and perhaps somewhat naively—I think I'd expect the Processor Trace instrument to just work with an adhoc-signed binary, as lldb and friends largely do—I'm not sure that such a high barrier for CPU perf counters is warranted, especially on an adhoc-signed binary.
Updated Xcode from 16.2 to 16.4, running Time Profile in Instruments, it launches the trace, but does not install or load on connected device, breaks the functionality. I am unable to debug...
ERROR:
Connection with the remote side was unexpectedly closed : <dictionary: 0x1f3c8b6d0> { count = 1, transaction: 0, voucher = 0x0, contents =
"XPCErrorDescription" => <string: 0x1f3c8b850> { length = 22, contents = "Connection interrupted" }
}
Domain: IXRemoteErrorDomain
Code: 6
User Info: {
DVTErrorCreationDateKey = "2025-08-09 00:47:53 +0000";
}
--
Connection with the remote side was unexpectedly closed : <dictionary: 0x1f3c8b6d0> { count = 1, transaction: 0, voucher = 0x0, contents =
"XPCErrorDescription" => <string: 0x1f3c8b850> { length = 22, contents = "Connection interrupted" }
}
Domain: IXRemoteErrorDomain
Code: 6
IOS 18.5
I'm currently exploring Instruments for profiling and tracing on macOS 15.6.1. I know there is the "network connections" instrument which records TCP/UDP information, however it seems to not include the "lo0" (loopback) interface.
Is there a way to configure it so that localhost traffic is included in the recording? as the application I'm tracing uses that and I want that information to be included in traces.
The documentation for network-interface-detection schema makes no mention of how it detects interfaces.
Thanks in advance.
I was reading through this documentation about instruments command line tool https://help.apple.com/instruments/mac/current/#/devb14ffaa5 and how it can be launched from the command line. However, unlike what the documentation states, there's no such instruments command anywhere on my macos M1 (OS version 15.6). That command gives:
$> instruments
zsh: command not found: instruments
I do have XCode installed which has the Instruments.App (GUI app) but not the command line utility:
$> ls Xcode.app/Contents/Applications/
... Instruments.app
Is that linked documentation up-to-date (it does say "latest" in the URL)? Is there some other way to install this command line utility?
Instruments CPU Profiler failed to start the profilable app (get-task-allow is set to true) with error "No PMI Record Found". Device is iPhone 13 Pro currently running iOS 17.0.3. Tried to profile in instruments shipped with Xcode 14.3.1, Xcode 15.0.1 and Xcode 15.1 Beta, same issue across. If it helps, I was able to successfully profile on iPhone X running iOS f16.7 using Xcode 14.2 instruments.
Hello,
I've upgraded both of my Apple TVs to tvOS 18. Since then, my app developed with SwiftUI has become almost unusable due to severe lag, particularly when scrolling in a LazyVStack. On the A1625 (Apple TV HD), the lag can last up to 20 seconds, while on the A2843 (Apple TV 4K, 3rd generation, Wi-Fi + Ethernet), it’s about one second.
I can consistently reproduce the issue with this minimal example:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ScrollView {
LazyVStack {
ForEach(0..<1000) { nb in
Button("Item \(nb)") {}
}
}
}
}
}
}
Using Instruments, I found that the hang is related to this call:
389.00 ms 71,4 % 6.00 ms +[_UIFocusRegionEvaluator __regionsByEvaluatingOcclusionsForBaseRegions:occludingRegions:baseRegionsCanOccludeEachOther:inSnapshot:]
Unfortunately, I can't attach the Instruments trace directly here, but you can download it from this link: https://drive.google.com/file/d/1sEIwXhr7_ajjRHZevCIW6jNOlPjaeU6L/view?usp=sharing
Important notes:
The same screen, when written in UIKit, runs smoothly on both devices.
After performing a factory reset on the older device, the performance issue disappeared. However, as you can imagine, I’m already receiving complaints from users who are understandably unwilling to reset their devices.
Does anyone know of a workaround until this is addressed by Apple?
I'm trying to run the Instrument "Animation Hitches", but it fails immediately after starting on the iPhone. This happens on multiple projects, including a brand new project.
I get the following errors:
Timestamp | Message
(Before Run Started) | Unexpected failure: Couriers have returned unexpectedly.
(Before Run Started) | Failed to start the recording: Failed starting
ktrace session.
The issue also happens with the instruments App Launch, but not with any other that I tested.
Is this a bug?
Using Xcode Version 16.1, Mac Mini M1 Sequoia 15.1. Running project on iPhone 14 Pro iOS 18.1.
Topic:
Developer Tools & Services
SubTopic:
Instruments