I think it may be because your code doesn't synchronize() the change to the defaults, so it doesn't save it immediately.
You could add a call to defaults.synchronize(), but you'd still be running this code every time the view is drawn (in .onAppear). That's a code smell; you're doing it in a place that can be executed multiple times within the app's lifetime, which opens you up to exactly the sort of behaviour you're experiencing.
A better way to do this is to move it to the main app startup, e.g.:
@main
struct MainApp: App {
init() {
// Is this the first launch of the app?
if(defaultsGetIsFirstLaunch(version: 6)) {
// Generate sample data...
defaultsUpdateIsFirstLaunch(version: 6, value: false)
}
}
}
func defaultsGetIsFirstLaunch(version: Int) -> Bool {
defaultsGetBool(forKey: "firstLaunchVersion\(version)", withFallback: true)
}
func defaultsUpdateIsFirstLaunch(version: Int, value: Bool) {
defaultsSet(value as Bool, forKey: "firstLaunchVersion\(version)")
}
func defaultsGetBool(forKey key: String, withFallback fallback: Bool) -> Bool {
guard let value = UserDefaults(suiteName: "myappgroup")?.object(forKey: key) else { return fallback }
return value as? Bool ?? fallback
}
func defaultsSet(_ value: Any, forKey key: String) {
UserDefaults(suiteName: "myappgroup")?.set(value, forKey: key)
UserDefaults(suiteName: "myappgroup")?.synchronize()
}
Note: I abstract the defaults functions out to their own methods, as above, so I have a method that gets a Bool from the defaults, one for an Int, one for a String etc., and a single method that sets a value in the defaults.
The get functions take a 'fallback' value, so if the value hasn't been set yet, it will return the fallback value instead.
So... In the code above, it runs in the main app's init() function. It checks if this is the first launch and passes in true if the key hasn't been set yet. It hasn't, so it returns true - this is the first launch of version 6. We generate the sample data, then we set the defaults value to false. The next time you run the app, the key has been set to false, so the code doesn't run anymore.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Need more info. Which version of watchOS is the Watch on?
If you also upgraded your Watch to watchOS 26, you cannot downgrade to watchOS 18.
You state that you cannot connect the Watch with the phone, but you don't say why not. What's stopping you? Is there an error message on the Watch? On the iPhone?
Topic:
Community
SubTopic:
Apple Developers
Tags:
If you found the solution, please accept your own reply as the correct answer. That'll show others that your post has an answer, and will help them when they come across your post when searching. Thanks!
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Your posts appear to be spam. If you're attempting to advertise your new app to us, please do not bother. We don't want to know. That's not what these forums are here for.
Also, you've picked random tags for your posts, which just pollutes those various sections unnecessarily.
Please be a better person on the internet.
Topic:
Business & Education
SubTopic:
Device Management
Tags:
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. We are not employees of Apple.
Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums.
And, when you ask your question over there, add some useful info, like how you're trying to access the files, what files, where. Are you using Finder? Have you tried creating a new user on your Mac and signing into iCloud on that new account? All this is relevant info.
Thanks.
Topic:
Community
SubTopic:
Apple Developers
Tags:
You haven't told us what the actual problem is?
Are you seeing a specific error?
What image sizes have you tried?
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Prove it.
All you've done is posted a load of text that's hard to read because you haven't bothered to format it in any way.
There's no mention of Vodafone in that text, and if the profile is "hidden" then how do you know it's there? If it's in your installed profiles list, then it's not hidden. Are you on Vodafone UK? Was the iPhone originally a Vodafone device? Too much information is left out for anyone to be able to help, and anyway...
You're in the wrong place for your paranoia. These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. We're not here to debug your device.
Topic:
Community
SubTopic:
Apple Developers
Have you raised a Feedback report? If not, please do so at https://feedbackassistant.apple.com/ then post the FB number here.
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Installing iOS 26 would be completely unrelated to this.
Also, why would you think it's iOS that caused it? Meta are the ones sending you the notifications, so you should raise any issues with them, not Apple, and not us random Developers on these forums.
Meta restricted your accounts for a reason - ad that reason is shown in that first screenshot. It is totally inappropriate for these forums.
Topic:
Community
SubTopic:
Apple Developers
There was no need for you to create two posts about the same issue. That's just spamming the forums. Please don't do that.
I can't help you with the first part, but your second part makes no sense. You're saying the developers only have your app's source code for an old version, but they uploaded the latest version of the app, so they must have had the source code for the latest version in order to build it and submit it to the App Store.
You cannot take the built version from the App Store and get the source code from it. That's not how it works. Source code for apps is not uploaded to the App Store.
The source code will be with your developers, so you will have to get the latest version from them. If they claim they don't have it, well that's not something we can help you with in the Developer Forums, sorry.
Topic:
Developer Tools & Services
SubTopic:
General
You want to leave the Developer Program? Turn off auto-renewal at https://developer.apple.com/account/
You'll still have access to the Developer Program until the end of your membership year.
If you want to turn off betas, just go into Software Update and turn off "Beta updates".
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
If you take a screenshot, when it appears as a thumbnail to the lower right of the Simulator window, right-click on it. You can save it to the Desktop or Documents. I think it will continue to save screenshots to the Desktop from then on, but not sure.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Menu items are context-aware. Are you in exactly the same place in both Xcode 16 and 26, so that the menus and the inspectors should be the same?
The little code I can see behind the menus in those screenshots is different, so go to exactly the same file, in exactly the same place and see whether the inspectors are there or not.
If they have definitely been removed then you should raise this as a bug, at: https://feedbackassistant.apple.com/
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Have you raised a Feedback report? If not, please do so at https://feedbackassistant.apple.com/ then post the FB number here.
Then, if it's concerning you, downgrade to macOS Sequoia 15.5 and restore from a backup (from before you installed macOS 26) and see whether the battery drain continues. If it does, then it's your hardware and you should get it checked out under warranty. If it doesn't happen then it's likely a bug in macOS 26, and you'll have rides the feedback report already.
Topic:
App & System Services
SubTopic:
Hardware
Tags:
I think it may be because your code doesn't synchronize() the change to the defaults, so it doesn't save it immediately.
You could add a call to defaults.synchronize(), but you'd still be running this code every time the view is drawn (in .onAppear). That's a code smell; you're doing it in a place that can be executed multiple times within the app's lifetime, which opens you up to exactly the sort of behaviour you're experiencing.
A better way to do this is to move it to the main app startup, e.g.:
@main
struct MainApp: App {
init() {
// Is this the first launch of the app?
if(defaultsGetIsFirstLaunch(version: 6)) {
// Generate sample data...
defaultsUpdateIsFirstLaunch(version: 6, value: false)
}
}
}
func defaultsGetIsFirstLaunch(version: Int) -> Bool {
defaultsGetBool(forKey: "firstLaunchVersion\(version)", withFallback: true)
}
func defaultsUpdateIsFirstLaunch(version: Int, value: Bool) {
defaultsSet(value as Bool, forKey: "firstLaunchVersion\(version)")
}
func defaultsGetBool(forKey key: String, withFallback fallback: Bool) -> Bool {
guard let value = UserDefaults(suiteName: "myappgroup")?.object(forKey: key) else { return fallback }
return value as? Bool ?? fallback
}
func defaultsSet(_ value: Any, forKey key: String) {
UserDefaults(suiteName: "myappgroup")?.set(value, forKey: key)
UserDefaults(suiteName: "myappgroup")?.synchronize()
}
Note: I abstract the defaults functions out to their own methods, as above, so I have a method that gets a Bool from the defaults, one for an Int, one for a String etc., and a single method that sets a value in the defaults.
The get functions take a 'fallback' value, so if the value hasn't been set yet, it will return the fallback value instead.
So... In the code above, it runs in the main app's init() function. It checks if this is the first launch and passes in true if the key hasn't been set yet. It hasn't, so it returns true - this is the first launch of version 6. We generate the sample data, then we set the defaults value to false. The next time you run the app, the key has been set to false, so the code doesn't run anymore.
- Replies
- Boosts
- Views
- Activity
Need more info. Which version of watchOS is the Watch on?
If you also upgraded your Watch to watchOS 26, you cannot downgrade to watchOS 18.
You state that you cannot connect the Watch with the phone, but you don't say why not. What's stopping you? Is there an error message on the Watch? On the iPhone?
Topic:
Community
SubTopic:
Apple Developers
Tags:
- Replies
- Boosts
- Views
- Activity
If you found the solution, please accept your own reply as the correct answer. That'll show others that your post has an answer, and will help them when they come across your post when searching. Thanks!
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
- Replies
- Boosts
- Views
- Activity
Your posts appear to be spam. If you're attempting to advertise your new app to us, please do not bother. We don't want to know. That's not what these forums are here for.
Also, you've picked random tags for your posts, which just pollutes those various sections unnecessarily.
Please be a better person on the internet.
Topic:
Business & Education
SubTopic:
Device Management
Tags:
- Replies
- Boosts
- Views
- Activity
These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. We are not employees of Apple.
Your question is more of a product support one, so I'd suggest you ask it over at the Apple Support Forums.
And, when you ask your question over there, add some useful info, like how you're trying to access the files, what files, where. Are you using Finder? Have you tried creating a new user on your Mac and signing into iCloud on that new account? All this is relevant info.
Thanks.
Topic:
Community
SubTopic:
Apple Developers
Tags:
- Replies
- Boosts
- Views
- Activity
You haven't told us what the actual problem is?
Are you seeing a specific error?
What image sizes have you tried?
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
- Replies
- Boosts
- Views
- Activity
Prove it.
All you've done is posted a load of text that's hard to read because you haven't bothered to format it in any way.
There's no mention of Vodafone in that text, and if the profile is "hidden" then how do you know it's there? If it's in your installed profiles list, then it's not hidden. Are you on Vodafone UK? Was the iPhone originally a Vodafone device? Too much information is left out for anyone to be able to help, and anyway...
You're in the wrong place for your paranoia. These are the Developer Forums, where developers of apps for Apple's platforms ask each other for hints and tips on coding. We're not here to debug your device.
Topic:
Community
SubTopic:
Apple Developers
- Replies
- Boosts
- Views
- Activity
Have you raised a Feedback report? If not, please do so at https://feedbackassistant.apple.com/ then post the FB number here.
Topic:
Programming Languages
SubTopic:
Swift
Tags:
- Replies
- Boosts
- Views
- Activity
Installing iOS 26 would be completely unrelated to this.
Also, why would you think it's iOS that caused it? Meta are the ones sending you the notifications, so you should raise any issues with them, not Apple, and not us random Developers on these forums.
Meta restricted your accounts for a reason - ad that reason is shown in that first screenshot. It is totally inappropriate for these forums.
Topic:
Community
SubTopic:
Apple Developers
- Replies
- Boosts
- Views
- Activity
There was no need for you to create two posts about the same issue. That's just spamming the forums. Please don't do that.
- Replies
- Boosts
- Views
- Activity
I can't help you with the first part, but your second part makes no sense. You're saying the developers only have your app's source code for an old version, but they uploaded the latest version of the app, so they must have had the source code for the latest version in order to build it and submit it to the App Store.
You cannot take the built version from the App Store and get the source code from it. That's not how it works. Source code for apps is not uploaded to the App Store.
The source code will be with your developers, so you will have to get the latest version from them. If they claim they don't have it, well that's not something we can help you with in the Developer Forums, sorry.
Topic:
Developer Tools & Services
SubTopic:
General
- Replies
- Boosts
- Views
- Activity
You want to leave the Developer Program? Turn off auto-renewal at https://developer.apple.com/account/
You'll still have access to the Developer Program until the end of your membership year.
If you want to turn off betas, just go into Software Update and turn off "Beta updates".
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
- Replies
- Boosts
- Views
- Activity
If you take a screenshot, when it appears as a thumbnail to the lower right of the Simulator window, right-click on it. You can save it to the Desktop or Documents. I think it will continue to save screenshots to the Desktop from then on, but not sure.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
- Replies
- Boosts
- Views
- Activity
Menu items are context-aware. Are you in exactly the same place in both Xcode 16 and 26, so that the menus and the inspectors should be the same?
The little code I can see behind the menus in those screenshots is different, so go to exactly the same file, in exactly the same place and see whether the inspectors are there or not.
If they have definitely been removed then you should raise this as a bug, at: https://feedbackassistant.apple.com/
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
- Replies
- Boosts
- Views
- Activity
Have you raised a Feedback report? If not, please do so at https://feedbackassistant.apple.com/ then post the FB number here.
Then, if it's concerning you, downgrade to macOS Sequoia 15.5 and restore from a backup (from before you installed macOS 26) and see whether the battery drain continues. If it does, then it's your hardware and you should get it checked out under warranty. If it doesn't happen then it's likely a bug in macOS 26, and you'll have rides the feedback report already.
Topic:
App & System Services
SubTopic:
Hardware
Tags:
- Replies
- Boosts
- Views
- Activity