How to use PlayerSettings.bundleIdentifier in final build?

So I have the following in one of my scripts:
Code (CSharp):

string bID = PlayerSettings.bundleIdentifier;

When I first tried to use it, I got the following error:
Code (csharp):

error CS0103: The name `PlayerSettings' does not exist in the current context

In order to get rid of this error, I needed to add the following at the top of the script:
Code (CSharp):

using Unity.Editor;

This works great in the Editor, but when I try to build for iOS I get the following error:
Code (csharp):

error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?

So I tried wrapping it like this:
Code (CSharp):

#if UNITY_EDITOR
using UnityEditor;
#endif

Still works in Editor just fine, but when I try to build for iOS I still get one of the above two errors.

I have searched forum but cannot figure out how to get around this.

If you cannot include “using Unity.Editor” then what is the point of even having something like PlayerSettings?

Any advice to get this working appreciated.

Thanks

Hi,

I know this is an old post but did you find any solution for this?

Thanks,
Sohaib