Skip to main content
Filter by
Sorted by
Tagged with
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 ...
markb's user avatar
  • 1,275
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 ...
Ceri Turner's user avatar
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 ...
Konrad's user avatar
  • 18.6k
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 ...
XDR's user avatar
  • 4,451
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 ...
Manthan Gevariya's user avatar
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 ...
Karl Ehrlich's user avatar
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 ...
Dries Cleymans's user avatar
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 ...
Zohar81's user avatar
  • 5,056
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....
asduskun's user avatar
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 ...
infoMining's user avatar
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 ...
redrock68's user avatar
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 ...
Aidar's user avatar
  • 9
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:&...
batrinu vlad's user avatar
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 ...
Kay's user avatar
  • 11
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 ...
Abdelkarim Achtaou's user avatar
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 ...
Arav Khandelwal's user avatar
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 ...
Flynn 's user avatar
  • 161
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 ...
LordGrim's user avatar
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....
erotsppa's user avatar
  • 15k
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 ...
Aura's user avatar
  • 41
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 { ...
Daniel Ramos's user avatar
  • 2,037
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 ...
Mustafa Demiraslan's user avatar
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" ...
Saravanan's user avatar
  • 123
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 ...
Tim_Waddles's user avatar
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 ...
davidgyoung's user avatar
  • 64.8k
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....
Peter Hlavatík's user avatar
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 ...
jho's user avatar
  • 293
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 ...
Boothosh81's user avatar
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) ...
Jatin Dave's user avatar
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....
Dragounow's user avatar
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 ...
Honey's user avatar
  • 2,880
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 ...
Isaac's user avatar
  • 1,890
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....
JoeKrynn's user avatar
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\&...
user4150758's user avatar
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 ...
user4150758's user avatar
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 ...
Joshua Browne's user avatar
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 ...
Joel S.'s user avatar
  • 91
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 ...
Victor's user avatar
  • 81
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 ...
iFateh's user avatar
  • 597
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 ...
Ketan Odedra's user avatar
  • 1,283
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 ...
Barrrdi's user avatar
  • 1,151
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 ...
Ryan's user avatar
  • 1,226
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 ...
iFateh's user avatar
  • 597
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 ...
markb's user avatar
  • 1,275
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 ...
Zash__'s user avatar
  • 293
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 ...
Jan L's user avatar
  • 253
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 ...
Ahmed Ayoub's user avatar
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, ...
Arieleo's user avatar
  • 409
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 ...
Nergezeev Alik's user avatar
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 ...
Nergezeev Alik's user avatar

1
2 3 4 5
76