Change preference from Settings.bundle in iOS

Hi,

I’m a new in appium and stuck on this.

My app is using Settings.bundle in iOS Settings to change server URL.
(After installing app, then the menu appears on Settings>My app.)

So far, I cannot find the way to change this server url with appium.
If I try to create script to access ‘Settings’ by appium, it failed to work. (It keeps opening and closing in real device and simulator doesn’t have my app’s menu on settings - only iOS default ones.)

Anyone has experience or any suggestion?

Hi @kevmando
you only can access settings in simulator , the real device can’t support.
FYI

Thank you, @Andy_Zhao.

I actually almost figured out with simulator with 2 different ways, but not try on real device yet.
However, there is still some unclear thing in Appium api, which looks more helpful if they work like their names such as autoLaunch and install_app()

I’m kind of worrying about this may block for my case if it doesn’t work on real device.

  1. Install app, then do not reset the simulator, and connect to ‘settings’ app, then change url, and launch app again.

  2. Replace .plist file from simulator preference directory in backend. It’s little bit a pain since Xcode recreates the folder name whenever building app, but you can find the latest directory.

Just realized this one doesn’t work well. Inconsistent, whether my app stays or not while creating new session for ‘Settings’…

I have to do the same thing in my AUT. I need to pick the QA server instead of DEV / PROD / Etc.

My workaround was to edit the Settings.bundle in Xcode prior to building the app for testing. It was as simple as changing:

option_2_key

to this:

option_3_key

Assuming you have the ability to edit the source code you can check with your development team to see where you can set the default app settings for your app. Then once built and installed, it will already be setup with specific defaults.

Just to clarify this has nothing to do with the iOS Settings app specifically, though your app may expose settings there.

Hi, @Christopher_Graham.

Thank you for the reply.

My app is actually exposing the URL option with other options in iOS Settings. So it seems to bring another problem, which the default value is not taken until a user actually changes the value from there.

But it seems a good option for real device too, so I’ll ask developers to take the default value when loading.