Posts

Post not yet marked as solved
0 Replies
314 Views
Hey everyone, How do I detect that my View is coming into the foreground? The app has been suspended by iOS before, because I closed it (which is fine). I am running into the strange problem, that .onChange(of: scenePhase) is never triggered on my custom subview. It only works if I attach it to the first view inside the root view. Some context: My app is iOS 17 and iPhone only. does work: on TabView() inside ContentView() ContentView() is the root view of the app. struct ContentView: View { @Environment(\.scenePhase) var scenePhase var body: some View { TabView { CustomSubView() } .onChange(of: scenePhase) { oldPhase, newPhase in if newPhase == .active { // some code, does work } else if newPhase == .background { // some code, does work } } } does not work: on CustomSubView() inside TabView() inside ContentView() struct CustomSubView: View { @Environment(\.scenePhase) var scenePhaseCustomSubView var body: some View { NavigationStack { } .onChange(of: scenePhaseCustomSubView) { oldPhase, newPhase in if newPhase == .active { // some code, is not firing for some reason -> use onAppear? } else if newPhase == .background { // some code, does work } } } } Thank you for your help
Posted
by otacon85.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
Hey guys and gals, iOS 14 is taking 15 GB additional storage from my device – which is a problem since it only has 64 GB. I can see it under storage in the Info section of system settings. There are two entries with ~ 15 GB each at the very bottom ("System" and "Other"). How do I delete these additional files? Is this a bug? Should I file a radar? Thanks
Posted
by otacon85.
Last updated
.
Post not yet marked as solved
1 Replies
2.8k Views
Hey guys,I'd like to show a password prompt every time my app returns from the background (trust me, it makes sense, it's not annoying; it's similar to what 1Password does).So I need to show a certain ViewController every time the app enters the foreground or every 10 minutes.I tried a lot, but I don't seem to get it to work. For instance:func applicationWillResignActive(_ application: UIApplication) { print("called it")} func applicationDidBecomeActive(_ application: UIApplication) { print("called it") } func applicationWillEnterForeground(_ application: UIApplication) {print("called it")}These methods simply don't get called on my device. Please note that the app is iOS 13 only. There was some change I don't understand (scenes?).Does someone have an idea or can point me in the right direction?Thank you.
Posted
by otacon85.
Last updated
.
Post not yet marked as solved
8 Replies
2.2k Views
I have made an iOS 13 app with a watch extension. The app is written in English. I have localized it to German. Everything is fine with the iPhone app; however the watch extension is only available in English. The German localization is not loaded.When I list the available localizations by printing1 like so:print(Bundle.main.localizations)the iPhone app gives me:["en", "Base", "de"]which is fine for me, but the Watch Extension only lists:["en"]which isn't correct – "de" is missing.I have added German as a localization in the Interface Builder (Interface Builder Languages Screenshot) but that doesn't seem to work.I have also tried removing the German localization completely from the project and adding it back – didn't work either. (Localization screenshot with German localization enabled)What am I missing?Any help is appreciated. Thank you very much.1 I know that printing to the console is obsolete, you should use oslog instead, but I haven't gotten around to that yet, to be honest.
Posted
by otacon85.
Last updated
.