Hi guys,
I've been this app for quite a while and I wanted to add audio to it but I've encountered a strange bug. Whenever I try to play the audio from the testing device, it prints out that the audio file cannot be found. I've checked multiple times the names and the code and I get no errors there whatsoever. I have no idea what might be causing this. Here's a part of the code:
`import SwiftUI
import AVFoundation
struct Card: Identifiable {
let id = UUID()
let heading: String
let description: String
let imageName: String
let detailDescription: String
let sonification: String
}
struct ExplorepageUI: View {
@State private var selectedCard: Card?
@State private var showMore = false
@State private var currentIndex = 0
@State private var currentCards: [Card] = []
let galaxies = [
Card(heading: "The Mice Galaxies",
description: "They’re located about 300 million light-years away in the constellation Coma Berenices.",
imageName: "TheMiceGalaxiesHubble",
detailDescription:"""
Their name refers to the long tails produced by tidal action, the relative difference between gravitational pulls on the near and far parts of each galaxy, known here as a galactic tide. It is a possibility that both galaxies, which are members of the Coma Cluster, have experienced collision, and will continue colliding until they coalesce. The colors of the galaxies are peculiar. In NGC 4676A a core with some dark markings is surrounded by a bluish white remnant of spiral arms. The tail is unusual, starting out blue and terminating in a more yellowish color, despite the fact that the beginning of each arm in virtually every spiral galaxy starts yellow and terminates in a bluish color. NGC 4676B has a yellowish core and two arcs; arm remnants underneath are bluish as well.
The galaxies were photographed in 2002 by the Hubble Space Telescope. In the background of the Mice Galaxies, there are over 3000 galaxies, at distances up to 13 billion light-years.
""",
sonification: "SonificationoftheMiceGalaxies"),
`class MusicPlayer: ObservableObject {
private var audioPlayer: AVPlayer?
func playSound(named sonificationFileName: String){
if let url = Bundle.main.url(forResource: sonificationFileName, withExtension: "mp3"){
print("✅ Found audio file at: \(url)")
audioPlayer = try? AVPlayer(url: url)
audioPlayer?.play()
print("🎵 Audio should now be playing!")
} else {
print("❌ Audio file not found: \(sonificationFileName).mp3")
}
}
func pause(){
audioPlayer?.pause()
}
}
Code Diagnostics
RSS for tagEnable runtime checks to detect and avoid bugs in your code using Code Diagnostics.
Posts under Code Diagnostics tag
13 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I have some questions about the ADK6.3 Diagnostic function:
If HAP_DIAGNOSTICS_MANUFACTURER is not enabled when compiling ADK, after adding the device through Home, the collecting log function cannot be found in the device settings. What is the reason? How to solve it?
If HAP_DIAGNOSTICS_MANUFACTURER is enabled during compilation, the vendor URL needs to be added when transmitting the diagnostic log. How is this vendor URL defined? How to add it to diagnosticsURLParameters?
How can I use the Home App in iOS device to test diagnostic functions before obtaining certification for HomeKit accessories?
I have the same issue when I added IOS 18 to my code and the Code completion AI. The IOS went through but cant down load the AI got this error: The operation couldn’t be completed. (ModelCatalog.CatalogErrors.AssetErrors error 1.)
Domain: ModelCatalog.CatalogErrors.AssetErrors
Code: 1
User Info: {
DVTErrorCreationDateKey = "2024-10-20 16:04:19 +0000";
}
Failed to find asset: com.apple.fm.code.generate_small_v1.base - no asset
Domain: ModelCatalog.CatalogErrors.AssetErrors
Code: 1
System Information
macOS Version 15.0.1 (Build 24A348)
Xcode 16.0 (23051) (Build 16A242d)
Timestamp: 2024-10-20T09:04:19-07:00
Dear Senior Developer,
I come to you at a time where I am lost.
Over the last 2-3 months, I have noticed a series of crashes occuring on my app. This all started randomly and has now been a regular occurence. Usually, I would receive some detail as it relates to some class or view that is causing this error but now the only details I have is it relates to a UiViewController dealloc even though I am using SwiftUI.
Below I have attached the stack trace from firebase crash analytics. I have spent months on this and I am asking for the help of someone much more senior and knowledable to assist me in this regard.
Thanks again for your help and I await your response. I am also willing to share my screen LIVE to help you help me identify this issue.
manny.GoblinTools_issue_bfd18ee65a92b459d4ecef3475a9ec34_crash_session_032166c28b8c4764b13a6fdca636d2d6_DNE_0_v2_stacktrace.txt
In my React Native mobile application, we are experiencing app termination issues on a few devices (iPhone 13 & 14). We are not getting any logs on Xcode organizer after app termination due to memory leak or terminates by OS.
Could you please suggest a way to log app terminations or recommend any other platform where we can log such events? Alternatively, do you have any suggestions on how to resolve app termination issues?
As I trying to check "Publishing changes from within view updates is not allowed, this will cause undefined behavior." within the app in Xcode 15.4 , but unable to see that in the specific file but is getting logged in the Xcode , even I tried adding debugger for "All runtime issues" , its not working. Console like
Opposed to this I am expecting this to be visible in the file as
Anyone can pls help me in there!! Thanks!!
i am attaching crash logs would be really appreciated for any kind of help :)
Review Environment
Submission ID: f7cb438c-5784-44e7-abcf-4a787c9398ff
Review date: April 30, 2024
Version reviewed: 1.0
Guideline 2.1 - Performance - App Completeness
We were unable to review your app as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue.
Review device details:
Device type: iPad Air (5th generation) and iPhone 13 mini
OS version: iOS 17.4.1
crashlog-639DEF1C-6DE4-437F-BEFE-E0DA6F31FFD8.txt
crashlog-4EC7F1AA-18A9-4057-B1AD-9677FEA6981F.txt
After upgrading to iOS 17, Thread Performance Checker is complaining of priority inversion when converting a CVPixelBuffer to UIImage through a CIImage instance. It might be a false-positive or an issue?
- (UIImage *)imageForSampleBuffer:(CMSampleBufferRef)sampleBuffer andOrientation:(UIImageOrientation)orientation {
CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
UIImage *uiImage = [UIImage imageWithCIImage:ciImage];
NSData *data = UIImageJPEGRepresentation(uiImage, 90);
}
The code snippet above, when running in a thread set to the default priority results in the message below:
Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions
PID: 1188, TID: 723209
Backtrace
=================================================================
3 AGXMetalG14 0x0000000235c77cc8 1FEF1F89-B467-37B0-86F8-E05BC8A2A629 + 2927816
4 AGXMetalG14 0x0000000235ccd784 1FEF1F89-B467-37B0-86F8-E05BC8A2A629 + 3278724
5 AGXMetalG14 0x0000000235ccf6a4 1FEF1F89-B467-37B0-86F8-E05BC8A2A629 + 3286692
6 MetalTools 0x000000022f758b68 E712D983-01AD-3FE5-AB66-E00ABF76CD7F + 568168
7 CoreImage 0x00000001a7c0e580 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 267648
8 CoreImage 0x00000001a7d0cc08 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 1309704
9 CoreImage 0x00000001a7c0e2e0 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 266976
10 CoreImage 0x00000001a7c0e1d0 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 266704
11 libdispatch.dylib 0x0000000105e4a7bc _dispatch_client_callout + 20
12 libdispatch.dylib 0x0000000105e5be24 _dispatch_lane_barrier_sync_invoke_and_complete + 176
13 CoreImage 0x00000001a7c0a784 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 251780
14 CoreImage 0x00000001a7c0a46c 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 250988
15 libdispatch.dylib 0x0000000105e5b764 _dispatch_block_async_invoke2 + 148
16 libdispatch.dylib 0x0000000105e4a7bc _dispatch_client_callout + 20
17 libdispatch.dylib 0x0000000105e5266c _dispatch_lane_serial_drain + 832
18 libdispatch.dylib 0x0000000105e5343c _dispatch_lane_invoke + 460
19 libdispatch.dylib 0x0000000105e524a4 _dispatch_lane_serial_drain + 376
20 libdispatch.dylib 0x0000000105e5343c _dispatch_lane_invoke + 460
21 libdispatch.dylib 0x0000000105e60404 _dispatch_root_queue_drain_deferred_wlh + 328
22 libdispatch.dylib 0x0000000105e5fa38 _dispatch_workloop_worker_thread + 444
23 libsystem_pthread.dylib 0x00000001f35a4f20 _pthread_wqthread + 288
24 libsystem_pthread.dylib 0x00000001f35a4fc0 start_wqthread + 8
Dear all,
I have the following code in a view:
import SwiftUI
struct RosaView: View {
@State var rosa: [Rosa] = Rosa.testRosa()
@State private var apriNuovoGiocatore = false
@State var stagione: String = "2023/2024"
var rosaFiltrata: [Rosa] {
Rosa.testRosa().filter {
$0.stagione == stagione
}
}
@State private var selezioneGiocatore: Rosa.ID? = nil
@State private var ordine = [KeyPathComparator(\Rosa.ruoloGiocatore)]
var body: some View {
VStack(alignment: .leading) {
Text("Stagione: \(stagione)")
.fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/)
.font(.headline)
.foregroundColor(/*@START_MENU_TOKEN@*/.blue/*@END_MENU_TOKEN@*/)
.padding()
Table(rosaFiltrata, selection: $selezioneGiocatore, sortOrder: $ordine) {
TableColumn(Text("Nome").foregroundStyle(.blue), value: \.nomeGiocatore)
TableColumn(Text("Cognome").foregroundStyle(.blue), value: \.cognomeGiocatore)
TableColumn(Text("Ruolo").foregroundStyle(.blue), value: \.ruoloGiocatore)
TableColumn(Text("Data di nascita").foregroundStyle(.blue), value: \.nascitaGiocatore)
TableColumn(Text("Età").foregroundStyle(.blue)) {
Rosa in
Text("\(Rosa.etàGiocatore)")
}
}
}
.frame(width: 900, height: 400)
.toolbar {
Button {
apriNuovoGiocatore = true
} label: {
Image(systemName: "person.badge.plus")
.foregroundColor(/*@START_MENU_TOKEN@*/.blue/*@END_MENU_TOKEN@*/)
}
.sheet(isPresented: $apriNuovoGiocatore, content: {
nuovoGiocatore()
})
}
.navigationTitle("Rosa")
}
}
struct nuovoGiocatore: View {
@Environment(\.dismiss) var dismiss
@State var nomeNuovoGiocatore: String
@State var cognomeNuovoGiocatore: String
@State var nascitaNuovoGiocatore: String
@State var ruoloNuovoGiocatore: String
@State var etàNuovoGiocatore: Int
var body: some View {
NavigationStack {
Form {
TextField("Nome:", text: $nomeNuovoGiocatore)
TextField("Cognome:", text: $cognomeNuovoGiocatore)
}
.navigationTitle("Nuovo giocatore")
.toolbar {
Button("Cancel") {
dismiss()
}
Button("Aggiungi giocatore") {
let nuovoGiocatore = Rosa(stagione: "2023/2024", nomeGiocatore: nomeNuovoGiocatore, cognomeGiocatore: cognomeNuovoGiocatore, nascitaGiocatore: nascitaNuovoGiocatore, etàGiocatore: etàNuovoGiocatore, ruoloGiocatore: ruoloNuovoGiocatore)
Rosa.testRosa().append(nuovoGiocatore)
dismiss()
}
}
}
}
}
#Preview {
RosaView()
}
On this, I'm getting a strange error which is "Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs)" in the "var body: some View" statement of the view "nuovoGiocatore".
How can I avoid it? Am I doing something wrong in the coding?
Thanks,
A.
I am running xctests from command line on XCode 15.2 on iOS 17.2 simulators. As per WWDC2021 video on Memory issues, I am passing `-enablePerformanceTestsDiagnostics Yes' in following xcodebuild command.
xcodebuild test -project project_name.xcodeproj -scheme test-scheme -destination 'platform=iOS Simulator,name=iPhone 15 Pro' -enablePerformanceTestsDiagnostics YES
Final logs before test results:
Tests-Runner(16873) MallocStackLogging: stack logs deleted from /private/tmp/stack-logs.16873.10148c000.Tests-Runner.M6gFw
.xcresults is generated but no memgraph file is attached along with it.
Consider the following program, memory-leak.c:
#include <stdlib.h>
void *p;
int main() {
p = malloc(7);
p = 0; // The memory is leaked here.
return 0;
}
If I compile this with clang memory-leak.c and test the output with the built-in MacOS memory leak detector leaks using leaks -quiet -atExit -- ./a.out, I get (partly) the following output:
1 leak for 16 total leaked bytes.
However, if I remove the 'leaking' line like so:
#include <stdlib.h>
void *p;
int main() {
p = malloc(7);
return 0;
}
Compiling this file and again running leaks now (partly) returns:
0 leaks for 0 total leaked bytes.
The man page for leaks shows that it is only un-reachable memory that is considered a leak. Is there a configuration to detect un-free'd reachablemalloc segments?
xCode requested that I send in a bug report.
Failed to produce diagnostic for expression, please submit a bug report. I can't manage to paste the image here, so I'll just state that the latest Xcode, 15.1 seems to produce spurious error messages on screen which usually manage to disappear over time.
I'll send this in to feedback with the sysdiagnose report.
It's a major pain.
Our CI pipeline produces .xcresult bundles that allow developers to diagnose failures by opening them in Xcode. If the test crashes, we used to be able to open the diagnostic folders and inspect the raw test logs. As of Xcode 15, that option is no longer available. I know the Diagnostic data is there because I can view it with Xcode 14. Am I just missing something in the Xcode 15 UI? Or has the capability to browse the Diagnostics actually been removed?