Post

Replies

Boosts

Views

Activity

Stack buffer overflow error using JSONDecoder
I'm using JSONDecoder().decode(T.Type, from: data) to decode a JSON response from a server. It works in some cases but eventually my program crashes with the error "Stack buffer overflow". The size of the JSON data I'm trying to decide is about 16k, which is large, but not unusually so. The decode is happening in a non-main thread, but I tried pushing it into the main thread with the same results. Most of these crashes occur in the simulator rather than on a real device, but I'd like to figure out the problem anyway. I thought I'd try dispatching the work into a queue with a larger stack size, but I couldn't figure out how to make one. Is it possible? Thanks, Frank
1
0
1k
May ’23
Best way to determine region?
My app downloads files from AWS S3. What we'd like to do is replicate our files across several of Amazon's data centers (regions) to put the content closer to our users, who are worldwide. What I need is a way to determine in a very gross way which data center would be best to use. For example North America, Europe, Asia, etc. I don't want to use location services since I don't really need the exact location. Is there a simpler way to do this? I suppose I could use the localization settings, but I don't think that's really guaranteed to represent their actual location. Thanks, Frank
1
0
910
May ’24
Custom section header isn't visible
I have a tableview and I want to use a custom section header. Instead of writing out all the code to create the section header, I added the view to my XIB file and connected it to an outlet in my view controller. I hid the view behind another view so it isn't visible and doesn't take up any room in the layout of the screen. In my view controller, I removed the view from the layout (removeFromSuperview) and then I returned it from my viewForHeaderInSection function. I also implemented heightForHeaderInSection to make sure I get the right height. When I run my app, what shows up is a blank space in the table where I'm expecting the header view to be. The space is the right height, but there is nothing in it. I do not understand why.
Topic: UI Frameworks SubTopic: UIKit
1
0
401
Jul ’24
Location not tracking in background
I really need some help. I have been going back and forth with a customer of mine for weeks. Our app is supposed to track location in the background after a user starts it in the foreground. Every time I test it, it works. I can put the app in the background and walk around for hours. Every time he tests it, it doesn't work. He puts the app into the background and about a minute later, it stops tracking him. Then it starts again when the app comes back to the foreground. We have each tried it on two devices with the same results. I'm willing to post the rest of the details if anyone is interested in helping me, but the last couple of times I got no response, so I'm not going to bother unless I can get some help this time. Thanks.
1
0
457
Feb ’25
UINavigtionController as a child view leaves an unwanted gap
I have a situation where I need to add a UINavigationController as a child view controller within another view controller. When I do this, there is a gap between the bottom of the navigation controller's root view controller and the bottom of the navigation controller's own view. This happens even though I am constraining the navigation controller's view to the edges of its superview, not the safe areas. I'd really like to eliminate this gap, but nothing I have tried is working.
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
237
Mar ’25
What happened to Info.plist and AppDelegate?
I don't really like to use Storyboards (I prefer individual XIB files) and I definitely don't want to use SwiftUI or "Scene Delegates". I'm familiar with the steps necessary to create my own UIWindow in AppDelegate. With each subsequent version of Xcode, it seems to get harder and harder to set up a new project the way I prefer. In order to get rid of the default storyboard, I have to both delete the file and then remove the word "Main" from Main Interface in the target, which is not obvious (you sort of have to backspace over it and hit Enter). With the addition of "Scene Delegates" (I don't know what they are and I don't care), I now have to remove some methods from AppDelegate and a key from Info.plist. With the current version of Xcode, I'm left with an app that has no other values in Info.plist and no methods in AppDelegate except didFinishLaunchingWithOptions. What happened to all that stuff? Should I manually create it or copy it from an older project? Will iOS even still call the rest of the AppDelegate methods if I create them? What happens if I want to change something that used to reside in Info.plist, such as Bundle display name? Do I just go in and add it? Why can't Apple just add a third option to create an empty project instead of making you start with Storyboards or SwiftUI? I know that Apple is keen on attracting new developers who have time to learn whatever they put out, but I hope they still care about people like me, an iOS developer since 2009 who doesn't want to completely relearn iOS programming every three years. Thanks, Frank
0
0
886
Aug ’22
Xcode won't save my source control credentials
My company uses Beanstalk, a commercial provider of Git repositories. Within Xcode, there is no option to add a Beanstalk account. When I open Xcode and try to do a VCS operation, Xcode prompts me for my username and password. From then on it works normally except that when I close Xcode and reopen it, it prompts me for the credentials again. The Git command-line tool doesn't do this. It saved my credentials in the keychain when I first ran it, and doesn't ask me for them anymore. Is there any way to get Xcode to either use the credentials stored by the Git command line app or store the credentials itself? I've tried contacting the people who run Beanstalk but they couldn't help me. Thanks, Frank
0
0
507
Mar ’23
Image asset not recognized in interface builder
I added an asset catalog to an old iOS project that I'm in the process of updating. The app was originally created before asset catalogs existed. I added an image and an icon set to my catalog. The icon works, and the image shows up when I run the app, but Interface Builder doesn't recognize the image by name when I type it into the Image field on an imageview. I'm guessing that there is something somewhere which causes interface builder to read an asset catalog, which is probably not set on my old project, but I can't figure out what it is. Thanks, Frank
0
0
705
Jun ’23
Xcode won't remember my Git credentials
I can't get Xcode to permanently remember my Git credentials. It remembers them for as long as Xcode is open, but when I close it and re-open it later, it prompts me for the credentials again. I don't see any kind of an option to save them. I use the 'git' command-line program on my computer and I've stored my credentials there, but Xcode doesn't seem to be able to access them that way. How can I get Xcode to remember my credentials?
0
2
596
Aug ’23
Crash during startup [CBUUID initWithData:]
The crash logs for my app show an occasional crash that happens during the launch of the app. The highlighed line is "CoreBluetooth -[CBUUID initiWithData:]. The stack trace ends with "static AppDelegate.$main()". My app does use Core Bluetooth, but there are no Bluetooth related functions in the App Delegate. Also, my app does not use [CBUUID initWithData:] explicitly anywhere. With a stack trace that contains no reference to any of my code, it is extremely difficult to figure out what is going on. I cannot reproduce the crash on any of my own devices. One of my affected users says the app crashes on startup on his phone consistently, even if he deletes and reinstalls it.
0
0
572
May ’24