Skip to main content
Inspiring
September 16, 2015
Answered

Accessing iOS Settings

  • September 16, 2015
  • 1 reply
  • 408 views

Hi folks,

I'm attempting to access the custom settings I created for my app using the Settings.bundle. However, I can't seem to access the .plist from within ActionScript.

I'm using Julian Dolce's iPhoneAppSettings.as ( https://code.google.com/p/as3iphone/source/browse/#svn%2Ftrunk%2FClasses%2Fcom%2Fflashiphonedevelopment%2Fsettings) which uses the following to read in the .plist:

__path = "Library/Preferences/" + NativeApplication.nativeApplication.applicationID + ".plist";

__file = File.userDirectory.resolvePath( __path );

if( __file.exists )

{

   readBinary( __file );

}

This consistently fails as __file.exists returns false. After doing some research, I also tried __path = "AppData/Library/Preferences/" + NativeApplication.nativeApplication.applicationID + ".plist"; to no avail.

I successfully created the Settings; when I install my app and go to Settings, I see the Settings page for my app. Using XCode's Devices window, I can verify that the .plist file has been installed and that its name matches NativeApplication.nativeApplication.applicationID + ".plist". I'm wondering if I simply have the wrong path to the .plist file? I know that Julian's code is about 5 years old, so maybe the path to the .plist file has changed? Is there a better way of accessing this file?

TIA,

--Chi-An

This topic has been closed for replies.
Correct answer c_a_chien

Hey, FYI, the original code does work. I was tripped up by a quirk in iOS: the {applicationID}.plist doesn't exist until you go into the Settings app and look at the custom Settings for your app. I must have been testing it in a different order. If you install the app, then go into Settings, and then launch the app, the file does exist. You can verify this by looking at XCode's Device window: track when the .plist shows up in Library/Preferences.

1 reply

c_a_chienAuthorCorrect answer
Inspiring
September 16, 2015

Hey, FYI, the original code does work. I was tripped up by a quirk in iOS: the {applicationID}.plist doesn't exist until you go into the Settings app and look at the custom Settings for your app. I must have been testing it in a different order. If you install the app, then go into Settings, and then launch the app, the file does exist. You can verify this by looking at XCode's Device window: track when the .plist shows up in Library/Preferences.