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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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.
I have an app, which has been in production for about 8 years, which uses a live camera view for the purpose of capturing barcodes. The app configures the camera for continuous autofocus with this code:
if ([videoDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
videoDevice.focusMode = AVCaptureFocusModeContinuousAutoFocus;
}
This has worked fine for years, but a customer who just upgraded to an iPhone 14 says that it doesn't work on his phone; the image never focuses and the barcode cannot be read.
Has something changed recently, either in iOS or with the iPhone 14, that would render this code incorrect? Xcode does not flag it with any warnings.
Thanks,
Frank
I have some Swift classes in my project that extend an Objective-C base class, which in turn extends NSObject. I did this years ago when Swift was new in order to take advantage of some Objective-C code that was difficult to rewrite in Swift. It's not a common situation but it has been working fine for a long time.
One of these classes is used as the key to a Dictionary and thus needs to be Hashable. The way I did this was to implement an == function and override the 'hash' property. It is a very simple case where the identity of the object is based on a single integer:
static func == (lhs: FishModel, rhs: FishModel) -> Bool {
return lhs.fishId == rhs.fishId
}
override var hash: Int {
return fishId
}
I believe that I initially tried to add "Hashable" to the class definition but was told it was redundant. I'm not sure why that is, but it worked fine without it.
Today I took the latest Xcode update to 15.2, and now my project won't compile anymore. The compiler error says that my class "does not conform to protocol Hashable". Adding Hashable to the class definition did not fix it. There are also some unusual errors about missing files, such as abi.json, swiftdoc, swiftmodule, and swiftsourceinfo.
Was this caused by the Xcode update? How do I fix it?
I manage apps and servers on behalf of several customers. Recently they all started getting a message from Apple that says, "The Certification Authority for APNs is changing".
I don't understand how or if this affects me. My servers are all hosted on Amazon EC2 instances. I have never had to install any specific certificate for APNs to work.
Is this new CA something that I can expect my servers to receive automatically as part of their system updates? If not, how do I install it?
Topic:
App & System Services
SubTopic:
Notifications
I have a popover view containing a tableview, and inside of the tableview are various UITextFields.
If one of the text fields is selected and the keyboard is showing, and I swipe downwards on the popover view, the popover closes, but the keyboard remains visible.
I updated my viewWillDisappear method on the view controller to have it issue a resignFirstResponder to the active input view when the popover closes, and although this code gets called, it doesn't close the keyboard.
The problem only exists on an iPhone. When I run the same code on an iPad, it works as expected (tapping outside of the popover view closes both the view and the keyboard).
If I dismiss the popover myself after issuing resignFirstResponder, that works. It is only the case where the user swipes down to dismiss that the problem appears.
Did something just change in Swift with regard to initializer inheritance?
Since installing Xcode 14.3, I have some code that is flagged with errors when I try to initialize a class using an initializer inherited from its superclass. This has always worked in the past.
I wrote an app for my own personal use. It is loaded onto my iPhone as a debug build and I also have a build on my Mac. These builds expire every few months and force me to go back into Xcode and rebuild them. Is there a better solution?
I am not an enterprise and don't have a business account, I'm just an individual developer.
class A: Codable {
var x: String?
}
class B: A {
var y: String?
}
When I try to decode class B, the property "y" remains nil even though there is a value for it in the JSON data. If I change it to B: Codable then it works.
When I try to search for a solution, all I can find is people overriding init methods and doing decoding manually in some way. I am having a hard time believeing that this is the right answer.
Surely, coding works across class hierarchies?
Topic:
Programming Languages
SubTopic:
Swift
My app needs to track background location for a period of several hours while the user is using it, and we want to allow the user to switch apps or lock their phone while this is happening. We don't need to track location permanently and because of this, we don't want to request the "Always allow" permission.
The app requests "While in use" permission and it has the "Location updates" background mode enabled. The CLLocationManager has 'allowsBackgroundLocationUpdates' set to true, 'pausesLocationUpdatesAutomatically' false, kCLLocationAccuracyBest, kCLDistanceFilterNone, and .fitness for the activity type (we expect the user to be walking).
The app also initializes a CLBackgroundActivitySession while it is tracking location and invalidates it when done.
When I test this combination on my iPhone, it works fine. I get location tracking in the background for as long as I need it, regardless of what else I do with the phone.
However, my customer says it doesn't work for him. He is using a Wifi-only iPad with an external GPS receiver called "BadElf GPS Pro". He says that the external GPS receiver works fine with other apps on his iPad. With my app, he gets background location tracking only for a short time, and then it stops.
The app does monitor the "locationManagerDidPauseLocationUpdates" callback and posts a local notification if it gets called, but it doesn't get called. I've also confirmed with him that he is not force-quitting the app and the app is not otherwise being terminated by iOS.
Is there something I'm missing?
An app I've been working on for weeks suddenly started giving me this error when I try to archive it:
"Command PhaseScriptExecution failed with a nonzero exit code"
I tried cleaning the build folder, restarting Xcode, and restarting the computer. The app compiles and runs, it just won't archive.
I deleted the entire project folder and re-cloned it, that didn't fix the problem either.
My coworker is able to archive the same project on his computer without any problem. The only difference we can find is that my computer has Xcode 14.3 and he has 14.2
Unfortunately I have no idea what the error message means. I think it might have something to do with Pods, but I didn't install the pods, and don't really understand how Pods work.
Is this a new bug in Xcode 14.3? What's the fix?
Thanks