Post

Replies

Boosts

Views

Activity

Linking arm64 static library for iPhoneSimulator
I work on an iOS app, written in Objective-C and C++, that uses a static library. I build this library using a Run Script in Build Phases in Xcode. This is a fat library, containing arm64 code built for iPhoneOS, and x86_64 code built for iPhoneSimulator. I'm trying to figure out how to create an arm64 iPhoneSimulator build of my app, and I'm running into a problem. If I simply enable arm64 debug builds, I get an error message saying "building for iOS Simulator, but linking in object file built for iOS", indicating that the arm64 iPhoneOS code in the library is not compatible with an arm64 iPhoneSimulator target. Now, I can build the library as arm64 for iPhoneSimulator, but that means I'll have to build a separate library for the simulator build, since lipo won't combine arm64 iPhoneOS and arm64 iPhoneSimulator builds in one file. My question: how can I get Xcode to link with a different library for iPhoneSimulator builds than for iPhoneOS builds? All I can come up with is to use completely separate targets for debugging in the simulator vs. debugging on a real device, but that seems ugly. (It would be even better if I could use the same library for both arm64 iPhoneSimulator and iPhoneOS builds. The library in question is a math library which makes no system calls, so I think the same code should be usable for both builds, if only I could get the linker to allow that.)
2
0
85
Mar ’25
How to steal focus from another app's text field?
I have written a calculator app. Its main window is a UIView subclass that usually receives user input from the touchscreen, tapping on a virtual keyboard (not the standard pop-up keyboard). I recently added hardware keyboard support. In order to receive key events, I implemented canBecomeFirstResponder and made it always return YES, and I'm calling becomeFirstResponder whenever the main window becomes active, and resignFirstResponder when it becomes inactive. This is working fine except for one scenario: when running the app on an iPad, together with another app, using Split View or Slide Over, and the other app has keyboard focus on a text field, my app doesn't receive keyboard events, even when it's the foreground app. I have to go into the other app, and tap somewhere outside a text field, and then return to my app, before my app is getting key events again. If the user taps on an actual text field in my app, it gets focus just fine, of course, but apparently my UIView calling becomeFirstResponder is not enough to take away the focus from the other app. Is there a way to steal the focus from another app's text field in this scenario?
Topic: UI Frameworks SubTopic: UIKit
0
0
275
Dec ’24
How to receive hardware keyboard events but block pop-up keyboard
I have a calculator app, and I would like to add support for using it with a hardware keyboard. I understand I can receive keyboard events by making my view implement canBecomeFirstResponder and having it return YES, and then calling becomeFirstResponder when the view becomes active. The problem is: I don't want the pop-up keyboard to appear. The app has its own keyboard; the UI simulates a physical calculator, and handles tap events by figuring out which calculator key is pressed and then acting accordingly. So the pop-up keyboard would literally just get in the way. But I do want to receive key events from hardware keyboards. I'm thinking of making canBecomeFirstResponder check for the presence of hardware keyboards, and return NO if none are present. But I'm not sure how to deal with hardware keyboards being connected or disconnected while the calculator view is active, and I'm also concerned about the keyboard bar on iPads. Is it possible to get hardware keyboard events without anything interfering with my UI like that?
0
0
324
Jan ’24
Loading crash log wih Direct Distribution
I have a MacOS app which I publish using Direct Distribution. A user has reported a crash which I am unable to reproduce. They have provided me with a crash log, but I can't figure out how to link this to the source code in my project. It seems like this is easy for apps distributed using Test Flight or the App Store, which I have done with the iOS version of my app, but I'm having no luck figuring out how to do this with my Direct Distribution app. Is it possible?
0
0
320
Dec ’23
sceneDidEnterBackground not called from App Switcher
When I go from my app to the App Switcher by double-clicking the home button, the app is shown in the App Switcher view, still running. However, if I then kill the app by sliding it upward, it is killed without sceneDidEnterBackground ever having been called. This means the saved state ends up being whatever it was when the app was launched. In an older app, which uses applicationDidEnterBackground, this problem does not exist; the method is always called, regardless of how I exit it, including when the app is killed by sliding it upward in the App Switcher. Isn't sceneDidEnterBackground supposed to be called at the same moments as applicationDidEnterBackground in older apps? As far as I can see, it isn't, and I don't see how to get my app to write its state reliably. Saving state in sceneWillResignActive is not a good alternative, because in the App Switcher, the app is still running after that method is called, so whichever changes happen to its state after sceneWillResignActive is called would still be lost.
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
1.4k
Apr ’22