How to programatically open Settings/Preferences window in a macOS SwiftUI App

By inspecting the app menu, I found this solution: NSApp.sendAction(Selector((“showPreferencesWindow:”)), to: nil, from: nil) I assume that it may not pass App Review for using a private API, though, so less shady alternatives are still welcome. Update: This has actually passed App Review, so I had marked it as the answer. Update 2: For a … Read more

Creating feature in mac app to override the users security setting

Launch System Preferences from the Apple menu. Choose “Security & Privacy” and then click the “General” tab, followed by clicking the lock icon in the corner to unlock the settings. Look for “Allow applications downloaded from:” and choose “Anywhere”. Accept the security warning and allow. Note that you should be careful and aware that now … Read more

iPhone – How to detect if a key exists in NSUserDefaults standardUserDefaults

Do it the right way and register default values. NSDictionary *userDefaultsDefaults = @{ @”SomeKey”: @NO, @”AnotherKey”: @”FooBar”, @”NumberKey”: @0, }; [NSUserDefaults.standardUserDefaults registerDefaults:userDefaultsDefaults]; do this before you use anything from NSUserDefaults. The beginning of application:didFinishLaunchingWithOptions: is a safe place. You have to register the defaults each time the app launches. NSUserDefaults only stores values that have … Read more

Maintaining a common set of Eclipse preferences

You could of course export/import those settings. The other approach is to enable project specific settings for some settings. We have a very small Git repository with those kind of files: .settings/org.eclipse.jdt.core.prefs (compiler problem settings and formatter rules) .settings/org.eclipse.jdt.ui.pref (cleanup rules, common code templates) The common settings are just copied/merged in each projects .settings directory, … Read more

Android: Retrieving shared preferences of other application

Okay! using this code in Application 1 ( with package name is “com.sharedpref1” ) to store data with Shared Preferences. SharedPreferences prefs = getSharedPreferences(“demopref”, Context.MODE_WORLD_READABLE); SharedPreferences.Editor editor = prefs.edit(); editor.putString(“demostring”, strShareValue); editor.commit(); And using this code in Application 2 to get data from Shared Preferences in Application 1. We can get it because we use … Read more

Tab to select autocomplete item in eclipse?

I believe you are looking for “word completion” Left Alt + / though you can change it in “Preferences->General->Keys” to be whatever key combo. Pressing / multiple times cycles through the different suggestions. It’s not very intelligent. For example if you have String apple; and double apps; and you type double x = a and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)