Debugging

RSS for tag

Discover and resolve issues with your app.

Posts under Debugging tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

iOS App crashes only on physical devices at dyld4::prepare after upgrading the deployment target from iOS 13 to iOS 14
We recently updated our deployment target from iOS 13 to iOS 14 and have no problems running on simulators. However, app would crash right after we tried to launch it and this only happens to our app running on physical devices. The crash would happen before AppDelegate's 'didFinishLaunchingWithOptions' and it happens every time we launch the app on a device. We tried keeping everything else's, such as Pods dependencies, deployment target in iOS 13 while only having the deployment target of the app in iOS 14 but that didn't help and the crash still happened with the same stack trace. We also tried to check the Console app on Mac to see if there is any useful information but didn't find anything useful besides messages from SpringBoard such as 'application state changed to Terminated'. I couldn't find articles that are about the same issue so I am posting it here to see if anyone has any idea what might be the causes and how to fix it. Thanks in advance and here's the stack trace: Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [630] Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 fieldwire 0x1072455cc exchg_registrar::exchg_registrar() + 36 1 fieldwire 0x1072455cc exchg_registrar::exchg_registrar() + 36 2 dyld 0x1e53e3bdc invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 144 3 dyld 0x1e5432d08 invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 332 4 dyld 0x1e53e23d0 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 516 5 dyld 0x1e53e1868 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 280 6 dyld 0x1e53e0d7c dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 164 7 dyld 0x1e53eb94c dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 376 8 dyld 0x1e53e8758 dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 148 9 dyld 0x1e53e2100 dyld4::PrebuiltLoader::runInitializers(dyld4::RuntimeState&) const + 40 10 dyld 0x1e53e5388 dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 212 11 dyld 0x1e53ea0bc dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 176 12 dyld 0x1e5419608 dyld4::APIs::runAllInitializersForMain() + 292 13 dyld 0x1e53f2648 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 2876 14 dyld 0x1e53f0d88 start + 1992 ```.
4
0
810
Jul ’23
[iOS17 Beta][SwiftUI/UIKit]
I am trying to get a basic app working where a SwiftUI View is used as the inputAccessoryView of a ViewController. This worked and then stopped working. The issue now is the InputAccessoryView disappears when the textfield in it is tapped and a warnings are logged in the console. The InputAccessoryView returns upon tapping the screen again. Any help is appreciated, thanks Warnings: UITextEffectsWindow should not become key. Please file a bug to Keyboard | iOS with this call stack: ( 0 UIKitCore 0x00000001b205a040 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 17498176 1 UIKitCore 0x00000001b1fdbf00 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 16981760 2 UIKitCore 0x00000001b135c050 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3874896 3 UIKitCore 0x00000001b130139c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3503004 4 UIKitCore 0x00000001b1352d70 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3837296 5 UIKitCore 0x00000001b136033c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3892028 6 UIKitCore 0x00000001b107e500 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 869632 7 UIKitCore 0x00000001b14c5e00 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 5357056 8 UIKitCore 0x00000001b201b49c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 17241244 9 UIKitCore 0x00000001b201bfe8 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 17244136 10 UIKitCore 0x00000001b11e6cb4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 2346164 11 UIKitCore 0x00000001b19ae5c8 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 10503624 12 UIKitCore 0x00000001b105e990 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 739728 13 UIKitCore 0x00000001b13c0384 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 4285316 14 UIKitCore 0x00000001b11411dc 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 1667548 15 UIKitCore 0x00000001b1029464 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 521316 16 UIKitCore 0x00000001b10cfaf0 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 1202928 17 UIKitCore 0x00000001b1a3f578 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 11097464 18 UIKitCore 0x00000001b109581c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 964636 19 UIKitCore 0x00000001b109a168 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 983400 20 UIKitCore 0x00000001b10993dc 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 979932 21 UIKitCore 0x00000001b10976c4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 972484 22 UIKitCore 0x00000001b10df1d4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 1266132 23 UIKitCore 0x00000001b1e87d50 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 15588688 24 UIKitCore 0x00000001b168460c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 7185932 25 UIKitCore 0x00000001b1d756c4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 14464708 26 UIKitCore 0x00000001b1d74c1c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 14461980 27 CoreFoundation 0x00000001aef18e50 4D10D650-0AE2-3264-82CF-C654DC239382 + 855632 28 CoreFoundation 0x00000001aef23f84 4D10D650-0AE2-3264-82CF-C654DC239382 + 900996 29 CoreFoundation 0x00000001aeeb1d74 4D10D650-0AE2-3264-82CF-C654DC239382 + 433524 30 CoreFoundation 0x00000001aeec4104 4D10D650-0AE2-3264-82CF-C654DC239382 + 508164 31 CoreFoundation 0x00000001aeec8da0 CFRunLoopRunSpecific + 600 32 GraphicsServices 0x00000001f0c2c224 GSEventRunModal + 164 33 UIKitCore 0x00000001b1339154 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3731796 34 UIKitCore 0x00000001b1338db8 UIApplicationMain + 340 35 SwiftUI 0x00000001b2b9b1a8 5A2584FB-9A71-3724-A788-554A9BC99FC3 + 1663400 36 SwiftUI 0x00000001b2b09f2c 5A2584FB-9A71-3724-A788-554A9BC99FC3 + 1068844 37 SwiftUI 0x00000001b2af3c1c 5A2584FB-9A71-3724-A788-554A9BC99FC3 + 977948 38 APP_NAME 0x00000001026f40dc $s5APP_NAME0A3AppV5$mainyyFZ + 40 39 APP_NAME 0x00000001026f418c main + 12 40 dyld 0x00000001d1a7a4f8 81F3004E-360C-372E-BBF8-7E4304D23776 + 87288 ) Failed to retrieve snapshot. -[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID Skipping performing textoperation; partner: <UIKeyboardImpl: 0x104853200; frame = (0 0; 0 0); opaque = NO; layer = <CALayer: 0x281060780>>, targetSessioID: DE44ADE6-3DC8-416A-9275-630B2D4F1BC8, currentSessionID: Code: class ChatViewController: UIViewController { var chatViewController: UIViewController = UIHostingController(rootView: ChatView()) var chatBarViewController: UIViewController = UIHostingController(rootView: ChatBarView()) override func viewDidLoad() { self.addChild(chatViewController) view.addSubview(chatViewController.view) chatViewController.view.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ chatViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), chatViewController.view.topAnchor.constraint(equalTo: view.topAnchor), chatViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), chatViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) chatBarViewController.view.translatesAutoresizingMaskIntoConstraints = false chatBarViewController.view.backgroundColor = .clear } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) self.becomeFirstResponder() } override var inputAccessoryView: UIView { return chatBarViewController.view } override var canBecomeFirstResponder: Bool { return true } override var canResignFirstResponder: Bool { return true } } struct ChatViewControllerRepresentable: UIViewControllerRepresentable { ... }
0
1
994
Jul ’23
Firebase and Compiling errors with Xcode 15.0 beta 2
I am getting the following errors when I attempt to build my project since I updated Xcode to Version 15.0 beta 2 (15A5161b). I am wondering if anyone could help me figure it out as I have already cleared the cache and the build folder as well as reinstalling the firebase package entirely. Here are the two errors I have been receiving: "failed to verify module interface of 'Project_Name' due to the errors above; the textual interface may be broken by project issues or a compiler bug" (The code on the line this error is on is on a autogenerated file titled "Project_Title.private" and cannot be edited, "// swift-interface-format-version: 1.0") The other error I assume also has to do with the above issue, "no such module as 'firebase'" ( the code on line of question is "import Firebase".) I would appreciate ay help I could get because I cannot find any documentation or similar problems. I have attached screenshots below for your convenience. Thank you for your help!
5
2
1.5k
Oct ’23
Xcode IOS Error Keeps Popping Up On Specific Page
Hi There, I am currently coding an app which uses the CoreBluetooth Function to scan for nearby peripherals. I keep finding myself an error when I specifically click on my Bluetooth page. The error I am met with is: "Thread 1: "String does not represent a valid UUID"". I have tried my luck with fixing this error but can't see to find the root of the problem. Help would kindly be appreciated In finding how to fix this. Cheers, hupfawil2023
1
0
427
Jul ’23
Decoding png with CoreGraphics framework on iOS17 leads to loss of alpha channel
I used the following code to decode the image in png format into the allocated memory block *imageData. - (void)decodeImage:(UIImage*)image { GLubyte* imageData = (GLubyte*)malloc(image.size.width * image.size.height * 4); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef imageContext = CGBitmapContextCreate(imageData, image.size.width, image.size.height, 8, image.size.width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrderDefault); CGContextDrawImage(imageContext, CGRectMake(0.0, 0.0, image.size.width, image.size.height), image.CGImage); CGContextRelease(imageContext); CGColorSpaceRelease(colorSpace); int bytesPerRow = image.size.width * 4; //you can log [330, 150] RGBA value here, then gets wrong alpha value; int targetRow = 330; int targetCol = 150; u_int32_t r = (u_int32_t)imageData[targetRow*bytesPerRow*4 + targetCol*4 + 0]; u_int32_t g = (u_int32_t)imageData[targetRow*bytesPerRow*4 + targetCol*4 + 1]; u_int32_t b = (u_int32_t)imageData[targetRow*bytesPerRow*4 + targetCol*4 + 2]; u_int32_t a = (u_int32_t)imageData[targetRow*bytesPerRow*4 + targetCol*4 + 3]; free(imageData); } The CGBitmapInfo used is kCGImageAlphaPremultipliedLast | kCGBitmapByteOrderDefault. The problem is that the alpha channel is lost in the decoded result: For example, the RGBA values ​​of the target png at [row, col] = [330, 150] are R = 240, B = 125, G = 106, A = 80. If the decoding is correct, the expected result should be R = 75, G = 39, B = 33, A = 80 with AlphaPremultiplied. However, after decoding the png on iOS17, the result is R = 75, G = 39, B = 33, A = 255, where the alpha values ​​are all forced to 255. Xcode Version 15.0 beta (15A5160n). iPhone14 Pro. The png file:
2
1
1.3k
Jul ’23
App Crashes before 'didFinishLaunchingWithOptions' is Called
The app runs first time without any problem. But from next time it crashes before didFinishLaunchingWithOptions is called. Stack trace prints as below: thread #3, stop reason = hit Objective-C exception frame #0: 0x000000019eec389c libobjc.A.dylibobjc_exception_throw frame #1: 0x00000001a5d0284c CoreFoundation-[NSObject(NSObject) doesNotRecognizeSelector:] + 136 frame #2: 0x00000001a5ba3fa0 CoreFoundation___forwarding___ + 1592 frame #3: 0x00000001a5c0c350 CoreFoundation_CF_forwarding_prep_0 + 96 frame #4: 0x00000001a5bee290 CoreFoundation_CFLocaleCreateLocaleIdentifierForAvailableLocalizations + 76 frame #5: 0x00000001a5be63b8 CoreFoundation_CFLocaleCopyCurrentGuts + 816 frame #6: 0x00000001a5c0f1b4 CoreFoundation+[NSLocale currentLocale] + 16 frame #7: 0x000000019ffa00ac Foundation-[NSUserDefaults(NSUserDefaults) init] + 1132 frame #8: 0x000000019ff9e04c Foundation+[NSUserDefaults(NSUserDefaults) standardUserDefaults] + 64 frame #9: 0x00000001a81d41a0 UIKitCore___UIApplicationMainPreparations_block_invoke + 64 frame #10: 0x00000001038605a8 libdispatch.dylib_dispatch_call_block_and_release + 32 frame #11: 0x000000010386205c libdispatch.dylib_dispatch_client_callout + 20 frame #12: 0x00000001038766ac libdispatch.dylib_dispatch_root_queue_drain + 972 frame #13: 0x0000000103876e74 libdispatch.dylib_dispatch_worker_thread2 + 196 frame #14: 0x00000001f2be3dbc libsystem_pthread.dylib`_pthread_wqthread + 228
1
0
244
Jul ’23
Xcode 15 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named StopwatchSupport.ActivityIndicatorVisualStyle
Hello I'm encountering a strange error, probably linked to a bug in Xcode 15 beta 2. When running my app from xcod 15 Beta 2 (either on device running iOS16.5.1 or any simulator running iOS17) for some views I receive the following fatal error: 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named StopwatchSupport.ActivityIndicatorVisualStyle because no class named StopwatchSupport.ActivityIndicatorVisualStyle was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' From the stack trace, the error seems to be appearing just afterthos calls: #3 0x00000001b3faef54 in UINibDecoderDecodeObjectForValue () #4 0x00000001b3faf1ec in UINibDecoderDecodeObjectForValue () Thanks for any help guidance provided.
4
2
1.1k
Jul ’23
failed validation
I'm very new and trying to validate my app launch and keep getting the follow error. I cannot figure this out Asset validation failed Missing Info.plist value. A value for the Info.plist key 'CFBundleIconName' is missing in the bundle Apps built with iOS 11 or later SDK must supply app icons in an asset catalog and must also provide a value for this Info.plist key.
4
1
1.3k
Jul ’23
Showing Recent Issues ~/UnityFramework/UnityFramework.h:1:
Issue while building the code, I have exported the code from unity correctly. Where as the issue occurs. Thanks in advance Showing Recent Issues /Users/bashaameen/Downloads/mcl_ios_/UnityFramework/UnityFramework.h:1:9: While building module 'UIKit' imported from /Users/bashaameen/Downloads/mcl_ios_/UnityFramework/UnityFramework.h:1: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:9: While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6: /Users/bashaameen/Downloads/mcl_ios_/:1:9: In file included from :1: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:23:10: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:23: /Users/bashaameen/Downloads/mcl_ios_/Libraries/Plugins/IOS/NativeToolkit/Locale.h:9:9: Cyclic dependency in module 'Foundation': Foundation -> CoreFoundation -> Foundation /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLErrorDomain.h:10:9: Cyclic dependency in module 'Foundation': Foundation -> CoreFoundation -> CoreLocation -> Foundation /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:9: Could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:12:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImageDefines.h:17:10: Could not build module 'CoreGraphics' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVBase.h:30:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h:36:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:8:10: Could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h:8:9: Could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h:16:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h:14:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h:16:10: Could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h:8:9: Could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h:8:9: Could not build module 'Foundation' /Users/bashaameen/Downloads/mcl_ios_/UnityFramework/UnityFramework.h:1:9: Could not build module 'UIKit' Could not build Objective-C module 'UnityFramework'
0
0
367
Jul ’23
On/Off Button Title in updateUI()
I am working through the Getting Started with App Development and on Page 142 it has you write in the updateUI() function if else statement lightButton.setTitle("Off", for: .normal) and lightButton.setTitle("On", for: .normal). My app crashes every time after building it and running it. Image reference below. The app works perfectly fine before adding these two statements. import UIKit class ViewController: UIViewController { @IBOutlet var lightButton: UIButton! var lightOn = true fileprivate func updateUI() { if lightOn { view.backgroundColor = .white lightButton.setTitle("Off", for: .normal) } else { view.backgroundColor = .black lightButton.setTitle("On", for: .normal) } } @IBAction func buttonPressed(_ sender: Any) { lightOn.toggle() updateUI() } override func viewDidLoad() { super.viewDidLoad() updateUI() // Do any additional setup after loading the view. } } Getting this error at the end. libc++abi: terminating due to uncaught exception of type NSException (lldb)
5
0
389
Oct ’23
FirstTimeDebugging - compile warning
Dear community, I'm reading "Develop in Swift Fundamentals", and on page 89 it asks us to open a file from the downloaded file (page 9 - Download Student Materials link). I was running the last part of the exercise of page 89 and it seems I got stuck when trying to remove the last compile warning message: "1. Condition always evaluates to false" "Will never be executed" Please take a look at the screenshot, where you can see the whole code and context. I have tried to add a few breakpoints (rows 10 to 12) in order to see if they would get ignored but it looks like it's still there. Any idea how to remove / get rid of this compile warning message? Thanks, Rodrigo
4
0
716
Jul ’23
Debugging RealityKit CustomMaterial shaders
I'm stuck in trying to debug my shader cause it says "Unable to create shader debug session" (something about my metal build setting doesn't have debugging information) and I've tried to follow this : developer.apple.com/documentation/xcode/… I've made my metal build setting to produce debugging information - Yes, Include source code as instructed Is it because I'm doing an iOS app instead of macOS?
1
0
328
Jul ’23
Issue with React Native Fetch API: Handling Arrays of Objects on iOS 15.7.7 and Simulated iPhone 7 (iOS 14.5)
Hey fellow developers! I'm encountering a perplexing issue with my React Native app, specifically related to handling arrays of objects when using the Fetch API on iOS 15.7.7 and even on a simulated iPhone 7 running iOS 14.5. I'm reaching out for some collective wisdom to help shed some light on this situation. Here's a brief overview of the problem: Affected Platforms: The issue is observed on physical devices running iOS 15.7.7, as well as simulated iPhone 7 with iOS 14.5. However, it's important to note that the app works flawlessly on iPad devices with iOS 15.7.7 and various other simulators. The Fetch Request: In my React Native app, I'm making a simple fetch request to retrieve an array of objects from my backend API. The server returns a valid JSON response with the expected data. async function fetchSomething(id: string): Promise<SomeResponse> { const response = await fetch(`https://www.website.com/api/${id}`); return await response.json(); } Inconsistent Behavior: The strange part is that while the fetch request works perfectly fine on iPad devices and other simulators, it fails to handle the array of objects correctly on the affected platforms. Direct JSON File Fetch: To eliminate any issues with the backend API, I experimented by fetching a JSON file directly from the server with the same data that the API should provide. Surprisingly, the direct JSON file fetch works perfectly on all platforms, including the affected iOS devices. Accessing the Desired Array of Objects: Upon further investigation, I noticed that when attempting to access the desired array of objects in the response data: Working Example (iPad and Simulators): someArrayWithObjects [{"bodytext": "...", "ctype": "...", "header": "...", "headerLayout": "...", "pid": 0, "uid": 0}] Non-Working Example (iOS 15.7.7 and Simulated iPhone 7): someArrayWithObjects [{"ctype": null, "headerLayout": null}] The someArrayWithObjects in the non-working example lacks essential data compared to the working example, which might be causing the issue. By the way, the error occurs with any other array of objects of the same data response. Differences in Request Header Content-Length: Additionally, as mentioned in the original post, the "content-length" in the request header for the non-working example (iOS 15.7.7 and simulated iPhone 7) differs from the working example (iPad and other simulators). I'm puzzled as to why the "content-length" differs and how it might be impacting the processing of the response data on these specific iOS platforms. Perhaps the length differs because of the missing data in the response. Has anyone encountered a similar issue with React Native fetch requests on iOS 15.7.7 or older versions? Any ideas or insights into why this discrepancy in "content-length" might be causing the problem? Or any thoughts on why the "contentArray" is lacking data in the non-working example? I appreciate any help or suggestions to resolve this issue, as it's been quite challenging to pinpoint the root cause. Thank you in advance for your support and expertise. 🙏 Happy coding! 5steve
1
0
1k
Jul ’23
Peculiar EXC_BAD_ACCESS, involving a Task
I had to update a simple piece of code, so it could be delayed by a few ms in some cases. This is how I tried to achieve that, by using a Task: class SomeClass { private var availableStuff : Set&lt;Stuff&gt; = [] func updateStuff(lookingFor prop: SomeProp, updatedThing: String, waiting: Duration = .zero) { Task { if waiting != .zero { try await Task.sleep(for: waiting) } if var stuff = availableStuff.first(where: { $0.prop == prop }) { stuff.thing = updatedThing // print(availableStuff) self.availableStuff.remove(stuff) self.availableStuff.insert(stuff) // BAD ACCESS here } } } } It did work before implementing the delay, but now it would crash at the insert statement (sometimes at remove). Naively, I put a print statement beforehand and to my surprise, this kept the crash from occurring at all! I switched on Address Sanitizer, now it doesn't crash, even w/o the print statement. Am I using the Task wrong, somehow? How can I further diagnose this, so it doesn't happen later in production? Or should I just leave the print in and hope for the best? Thanks!
1
0
896
Jul ’23
Keeping track of thread creation in a process
In some cases, one of our daemons will end up with thousands of threads. Clearly a bug somewhere, but I can't see it in the code. (Admittedly, it's C++ which is a bit alien to me still. Anyway.) If I wanted to just be notified each time a thread was created in the process, what are some ways to do that? I assume dtrace and lldb have ways to od it, but I'm not quite sure what.
6
0
674
Jul ’23
SwiftData Fatal error: failed to find a currently active container
I'm new to Apple development and decided to learn using SwiftData and Xcode 15 beta 4 (though I'm starting to think I don't need that extra challenge). I've worked through many issues--with you all's help--but this is one I can't figure out and hasn't shown up in my searches. I'm working on the traditional task list app (with a Task model). I've tried several approaches to app structure, but each time I eventually hit this same error. It doesn't happen when I set up the new Xcode project, but eventually it does. I've cleaned the build folder, restarted the Simulator, and even rebooted the Macbook I'm working on. Here's what happens when I click Product > Run: the app builds successfully the Simulator displays a white screen as expected then the error appears. Here are the error messages: In the debug area it says: SwiftData/ModelContainer.swift:159: Fatal error: failed to find a currently active container for Task Failed to find any currently loaded container for Task) and in the warning in the editor says Thread 1: Fatal error: failed to find a currently active container for Task The debugger is highlighting this line in the call stack (not sure if that's useful as a newbie): #7 0x0000000100bb6d90 in Task.init(id:title:priority:) at /var/folders/3v/q8g4z9bx4lb9z6t7mhgwgghw0000gn/T/swift-generated-sources/@__swiftmacro_10BadgerTool4Task5ModelfMm_.swift:2 Here's the code: The Task model isn't complex: // Task.swift import Foundation import SwiftData @Model class Task { @Attribute(.unique) var id: UUID var title: String var priority: String init(id: UUID = UUID(), title: String, priority: String = "None") { self.id = id self.title = title self.priority = priority } } I have the model container set in the context of the highest view: // BadgerToolApp.swift import SwiftUI import SwiftData @main struct BadgerToolApp: App { var body: some Scene { WindowGroup { NavView() .modelContainer(for: Task.self) } } } I tried moving all other views one layer down (which is why the unnecessary NavView is there): // NavView.swift import SwiftUI import SwiftData struct NavView: View { @State var selectedCollection: Collection? @State var selectedTask: Task? var body: some View { NavigationSplitView( sidebar: { SideBarView(selectedCollection: $selectedCollection, selectedTask: $selectedTask) }, content: { ContentListView(selectedCollection: $selectedCollection, selectedTask: $selectedTask) }, detail: { TaskDetailView(selectedCollection: $selectedCollection, selectedTask: $selectedTask) } ) } } Trying to isolate my mistake I removed everything else related to SwiftData (except for the imports) and gave my views hard-coded data for the simulator like this: // SideBarView.swift import SwiftUI import SwiftData struct SideBarView: View { @Binding var selectedCollection: Collection? @Binding var selectedTask: Task? let collections = presetCollections //temp data var body: some View { List(collections, id: \.id, selection: $selectedCollection){ collection in NavigationLink(collection.name, value: collection) } List{ Text("All Tasks") Text("Settings") } .navigationTitle("Collections") } } Everything works as expected if I comment out the .modelContainer() modifier on the call to NavView view I change the Task definition from the @Model class to a regular struct like this: // Task.swift // with @Model removed import Foundation struct Task: Hashable { var id: UUID var title: String var priority: String init(id: UUID = UUID(), title: String, priority: String = "None") { self.id = id self.title = title self.priority = priority } } What am I missing? Could it be a bug? Thanks for your help!
11
4
7.8k
Aug ’23
my game is crashed in release mode with log: "name": "IoDispatcher", "description": "(Data Abort) byte write Translation fault"
here is my log: { "triggered": true, "id": 210291, "name": "IoDispatcher", "threadState": { "x": [ { "value": 1 }, { "value": 0 }, { "value": 73896 }, { "value": 6107867720 }, { "value": 14624363642880 }, { "value": 193526931390464 }, { "value": 1 }, { "value": 0 }, { "value": 3 }, { "value": 123 }, { "value": 2 }, { "value": 4294967293 }, { "value": 1099511627776 }, { "value": 0 }, { "value": 0 }, { "value": 0 }, { "value": 0 }, { "value": 2 }, { "value": 0 }, { "value": 4509545232 }, { "value": 0 }, { "value": 0 }, { "value": 4294967295 }, { "value": 16384 }, { "value": 4604246008 }, { "value": 0 }, { "value": 4604245920 }, { "value": 0 }, { "value": 0 } ], "flavor": "ARM_THREAD_STATE64", "lr": { "value": 4428080928 }, "cpsr": { "value": 1610612736 }, "fp": { "value": 6107868496 }, "sp": { "value": 6107867824 }, "esr": { "value": 2449473606, "description": "(Data Abort) byte write Translation fault" }, "pc": { "value": 4428080988, "matchesCrashFrame": 1 }, "far": { "value": 3 } }, "frames": [ { "imageOffset": 52602716, "imageIndex": 0 }, { "imageOffset": 51998460, "imageIndex": 0 }, { "imageOffset": 52467176, "imageIndex": 0 }, { "imageOffset": 83388868, "imageIndex": 0 }, { "imageOffset": 52491332, "imageIndex": 0 }, { "imageOffset": 52489360, "imageIndex": 0 }, { "imageOffset": 52025832, "imageIndex": 0 }, { "imageOffset": 51930384, "imageIndex": 0 }, { "imageOffset": 5816, "symbol": "_pthread_start", "symbolLocation": 148, "imageIndex": 8 }, { "imageOffset": 2952, "symbol": "thread_start", "symbolLocation": 8, "imageIndex": 8 } ] `},`
1
0
367
Jul ’23
Setting non-blocking on a pty not working
I'm porting some code to MacOS (13 in this case) and I'm having an issue with something that seems strange. Setting O_NONBLOCK on a pty fails with Inappropriate ioctl for device (25) I'm doing: rv = fcntl(fd, F_GETFL, 0); if (rv == -1) return -1 rv |= O_NONBLOCK; if (fcntl(fd, F_SETFL, rv) == -1) return -1; In fact, if I pass in 0 for "rv" to fcntl() it gives the same failure. Just for pty masters, not for anything else I've seen. I need it to be non-blocking to avoid lockups.
3
0
618
Jul ’23