3,781 questions
0
votes
1
answer
30
views
UserDefaults suites ("standard" and "custom") overlapping - the keys appear in both?
I'm currently working on a Swift project where I register default values to two different UserDefaults suites: the standard suite and a custom suite. However, I'm seeing an unexpected (potentially ...
0
votes
0
answers
25
views
Persist app state across reinstalls/multiple devices
So I’m trying to setup an existing app to work with iCloud syncing. The syncing part seems to be working for the most part.
When the app is first installed it sets up some data locally.
Throughout the ...
0
votes
1
answer
92
views
Understanding the relationship between suiteName and App Groups
Background
I'm developing a macOS applications that consists of a plugin and main application. I would like for both targets to be able to share the same settings. I want to manipulate my settings ...
0
votes
1
answer
89
views
API available to Swift that provides the Apple ID associated with the current macOS user?
Is there any API available to Swift that provides the name (which should be an email address, AFAIK) of the Apple ID associated with the current macOS user?
The following command line seems to provide ...
1
vote
1
answer
83
views
Is it possible to throw an exception with subscript?
I have written code below in Swift 5.10 to store and retrieve Codable data from UserDefaults by giving key value in the subscript, but there is some compile time error:
Expected '->' for subscript ...
0
votes
0
answers
75
views
Swift String Parser semicolon issues
i want to create an app that allows the user to edit user defaults which makes it free to silence the annoying update warnings but I have ran into an issue. The code should take a string and print a ...
0
votes
0
answers
31
views
NSUserDefaults resets to wrong 'Webkit' content on iOS simulator 17
I'm using the [NSUserDefaults standardUserDefaults] to store some values. It worked on previous simulators and still works on real devices.
However, after upgrading to iOS 17 simulators, the ...
0
votes
0
answers
126
views
Using Jamf to security write new configuration to managed application
I've learned that it's possible to inject new configuration to MDM managed application using MDM so that the managed app configuration changes that are pushed down from an MDM server appear in ...
0
votes
0
answers
58
views
How to update userdefaults in another viewController once it is saved in a different viewController without overwriting the first one
This is my User struct.
struct User: Codable {
let uid: String?
let name: String?
var profileImageUrl: String?
var bookmarkedRecipes: [String]? // This could be an array of recipe IDs....
0
votes
0
answers
202
views
Does the UserDefault api guarantee privacy?
This seems like an obvious behaviour for data privacy/security, but does the ios framework ensure that the UserDefault databases that the client app and its sdks access are restricted to only the ...
0
votes
1
answer
86
views
Can NSUserDefaults work across different code bases?
I am trying to share data between an objective c iOS appliation and a c# xamarin forms application using app groups.
I am setting up the initial data in the objective c project and passing the data ...
0
votes
0
answers
66
views
How to bind @Published variable value to @propertyWrapper in SwiftUI
I want to make variable user @Published, but then i get error:
'nil' is not compatible with expected argument type 'Published<UserLoginOutput.Response.Data?
import Foundation
protocol ...
3
votes
2
answers
2k
views
iOS 17 - UserDefaults getting cleared on relaunching the app
works good on iOS 16 and prior, but on iOS 17, User Defaults gets cleared.
I don't use Data Protection Entitlement.
I use app groups, and tried both UserDefaults.standard and UserDefaults(suiteName:&...
1
vote
1
answer
304
views
Overriding UserDefaults with XCUIApplication.launchArguments ignores all future updates to that key, so how do I test it?
I can successfully override the UserDefaults value by setting it with XCUIApplication.launchArguments. But based on this link and the behavior I've noticed, once I override the UserDefaults value all ...
0
votes
0
answers
70
views
UserDefault: Is there any solution to add Favorited Movies into UserDefault
the project is like this, i have a button of adding a movie into Favorited Movies page, and the user can delete the movie (.onDelete). but, the thing here is that whenever i delete the Movie from ...
0
votes
1
answer
108
views
Clear unused UserDefaults key values from app
I am currently working on app which has been there since last few years. In the app, there is some cache stored as UserDefaults whose keys have now been removed from the code. So i want to clear those ...
0
votes
1
answer
52
views
Swift/SwiftUI func not reading updated values from variables set in previous func
I am trying to have the getLastScore function to get the most recent score from an array and use it to update a view. I have confirmed that the addScore function is working as intended, but when I try ...
0
votes
0
answers
29
views
How do I print the UserDefaults information Label ? Swift
application welcome on first startup hello on next startup.
I tried using Scene Delegate UserDefaults but I can only print in console because I don't know exactly.
I want the SplashViewController ...
1
vote
1
answer
852
views
Is there a way to use CFBundleShortVersionString to recognize new builds in Testflight?
We don't increment version number in our builds because that would trigger a TF review. So instead we leave it as the same version and xcode automatically increment the build number instead so it's 0....
1
vote
1
answer
81
views
NSUserDefault don't access value in a sandbox MacOS app
I found after configuring my app sandbox, I can not access the preference value.
According the online blog, I have set com.apple.security.files.user-selected.read-write to YES in entitlements. Did I ...
3
votes
1
answer
131
views
Associate each enum case with a type in Swift
I'm trying to apply the dependency inversion principle to the UserDefaults and also make it as strong-typed as possible.
Suppose that I have the following enum:
enum LocalStorageKeys: String {
...
1
vote
1
answer
382
views
Macos Ventura Disable Three Finger Tap Gesture
How can I turn it off programmatically when the trackpad settings are set to "Tap with Three Fingers" in Macos Ventura operating system?
Option 1:
Option 2:
I tried the following defaults ...
0
votes
0
answers
388
views
How to store model data in Userdefaults swift?
My model class:
struct AllRestroVendor:Codable{
let vendorID, name: String?
let rating: Rating?
let option: [Options]?
enum CodingKeys: String, CodingKey {
case vendorID = "vendor_id"
...
0
votes
1
answer
66
views
Swift storing an Integer and displaying the changed Integer when reopening the app
I have an app where when I click a button it increases the value of an Int. When I close the app and then open it again, I want the value of the Int to be whatever it was before closing it. This is in ...
0
votes
2
answers
769
views
Preventing/Detecting iCloud migration of app data in UserDefaults and KeyChain
When a user gets a new iPhone, iCloud can restore app data from a different device, which copies info from UserDefaults and the Keychain.
This presents problems for my app when a user migrates from ...
0
votes
1
answer
577
views
Could not archive project in Xcode
I have iOS application build in UIKit with SwiftUI widget extension. Until now the archiving worked just fine. I've added App Group to share user defaults in following format: "group.MYTEAMID.sk....
1
vote
1
answer
446
views
How do I successfully use Xamarin Forms Share Extension to share NSUserDefaults value?
I'm trying to implement a Xamarin Forms Share Extension to allow my app to receive a zip file from another app.
I have successfully set up the App Group in the Apple Developer Account, am successfully ...
0
votes
0
answers
73
views
Why are my SwipeActions overflowing the listview SwiftUI
Why is my SwiftUI Swipe Action behaving like this?
I don't now how to add a GIF in stack overflow so here is a imagur link https://i.sstatic.net/VCKEE.jpg.
If you don't want to click on external links ...
3
votes
1
answer
104
views
Sometime NSManagedobject object become fault when passing object from one controller to another, is there any way to pass object as a value type objC
First controller
OptiiMobileTaskDetailViewController *taskDetailVC = (OptiiMobileTaskDetailViewController *)segue.destinationViewController;
[taskDetailVC setTask:task];
Second Controller
-(void) ...
0
votes
0
answers
64
views
NSUserDefault takes a few seconds to store the value
As the title says, I am trying to store coins in NSUserDefault.
This is how I register it in the AppDelegate -didFinishLaunchingWithOptions:
let defaults:UserDefaults = UserDefaults.standard
defaults....
0
votes
0
answers
413
views
Attempt to insert non-property list object for Key
I'm trying to store an NSString value in NSUserDefaults. It takes some UUID-like format (e.g. 7da0b3fd-25ca-42c5-a934-bd89362a016b) if the user is logged in or NULL otherwise.
However occasionally my ...
0
votes
0
answers
154
views
My newly created Swift decoder (for some old Obj-c persisted UserDefaults data) is getting nil for some specific existing and stored String field
Context:
I've been given the task of creating a persisted UserDefaults data importer from an old version of some app our team created some time ago.
That app was created using ObjectiveC, and some ...
0
votes
1
answer
592
views
unity - xcode build failed with NSUserDefaults.mm file not found message, possibly because com.unity.services.core folder is not in project folder
building an XCode project with an .xcodeproj file generated by unity 2021.3.3f1 fails with the message "Build input file cannot be found: 'users/---/ --project name--/Libraries/com.unity.services....
0
votes
1
answer
286
views
Isn't possible to store array of strings in defaults write?
I have a use-case where I have to store array of strings in defaults write but it seems like it is not working in applescript.
do shell script "defaults write com.subdomain.xyz -array \"abc\&...
0
votes
1
answer
492
views
How to convert window object to string in AppleScript?
I've an AppleScript that retrieves window id of an app.
Example following script retrieves the window id of Brave Browser.
set urls to {"https://google.com"}
tell application "Brave ...
0
votes
2
answers
238
views
Setting textView.attributedtext to an array of NSAttributedString values through UserDefaults swift
I'm stuck.
I set up an array as follows:
private var lyricArray : [NSAttributedString] = []
I have a game that has matches and misses. For each match I want the color of the text to be green and ...
3
votes
2
answers
3k
views
Swift UserDefaults not persisting after relaunching app
I am having a problem with my UserDefault settings not persisting when my app launches. I have read other posts on this matter and most are marked solved after various tips. I have implemented all of ...
0
votes
1
answer
400
views
Update a value on stuct codable identifiable and only userdefault cache this value
I have 2 structs codable : Student and Adress (which is linked to Student)
On my app, I fetch data from Firebase RTDB and then I store it with userdefault
Let's say a student changes his email and I ...
0
votes
1
answer
633
views
How to Update Array Index After Drag and Drop is Called in UserDefaults in CollectionView?
I'm Creating an demo, In this I have Drag and Drop Functionality , Drag and Drop function is working Perfectly Fine, My Concern is , when I close the app and came back to the View again, the same is ...
0
votes
1
answer
242
views
How to save multiple object in single UserDefaults
I've created NSObject class for "CurrentUser",
here, sign-up API will call & response data will insert into the "CurrentUser" model.
This is one type of global model, like in ...
0
votes
1
answer
505
views
Ability to determine whether a custom suite of UserDefault exists, enabling custom behaviour when it’s initially created
I’m creating a custom suite for UserDefaults:
var store = UserDefaults(suiteName: "custom")
I however need to trigger specific behaviour based on whether the suite already exists or not.
To ...
3
votes
1
answer
507
views
Is it possible for a sandboxed Mac app to write to the global defaults domain?
Is there any way to allow a sandboxed Mac app to read and write keys to the global user defaults domain (NSGlobalDomain/.globalDomain)? Right now, the writes are failing and this error is being logged ...
2
votes
1
answer
83
views
SignUp Button Not Working While Handling RootViewController?
I'm building an iOS app using a Storyboard. The root view controller is a Home View Controller. I'm creating the login/logout process, and it's mostly working fine, but I've got a few issues. I need ...
1
vote
2
answers
188
views
Reload table data only if cold launch or settings change
I have a simple two tabbed app which I'm trying to manage when or if the List reloads data from the network.
I want to have the app only reload data when:
cold booting first time (closed state to ...
0
votes
1
answer
175
views
Swift 5 Save AVAsset to UserDefaults
Users can scroll through the feed and retrieve videos from my cloud storage.
I would like to cache the videos (which I do successfully temporary in an array) but I want to retrieve the videos also ...
0
votes
1
answer
483
views
Swift: Using multiple UIPresentationControllers
I have a modal presentation for a card that uses a custom presentation controller, which works fine. I now need to use a presentation controller for another popup, but the difficulty is that it needs ...
0
votes
0
answers
97
views
How to display data getting from Users Defaults array of dictionary to TableView?
This image shows the functions i made to store and retrieve data from user defaults against a key
This is my model class
And this is where i retrieve data from userDefaults using function made in ...
1
vote
0
answers
77
views
What are the best practices for using objectIsForced with controls bound to a shared user defaults controller?
In the Preferences window of a macOS app on which I'm working, I have a number of controls that are directly bound via Interface Builder to the shared user defaults controller.
This works well, ...
0
votes
1
answer
1k
views
UserDefault boolean is always false
I've UISwitch, with that switch I give variable userDefaultYvelaSachmeli its own bool value, if UISwitch isOn I set it to true, otherwise false. Switch works fine, but it doesn't save value with ...
0
votes
1
answer
104
views
Save UISwitch's toggled data in UserDefaults
I've declared a boolean with default value true, if my UISwitch is on I want boolean variable to be true else false, my code works fine until I try to store that boolean in UserDefaults when I reset ...