Zendesk/Unity Mobile Platform Settings


To take advantage of native system tools to allow for file attachments through a system's respective platform-specific file browser, mobile platform builds must be compiled with the below listed dependencies and permissions calls.

Existing C# dependencies

Any dependencies (inclusive of theming libraries) required for the deprecated Zendesk C# wrapper for Unity should be removed from your project settings.

Note: The UnityTheme style for Android (android:theme="@style/UnityTheme") has been noted to cause build and run-time errors on exported Unity projects. We recommend ensuring this is removed before proceeding.

iOS dependencies

Limited Photos Library

With the release of iOS 14, the new Photos Picker was introduced with the Limited Photos Library feature, where users can directly control which photos and videos an app can access.

The Zendesk SDK for Unity does not yet support this feature. This means that access to the full library is required for the attachment functionality to work.

Info.plist dependencies

Your app's Info.plist file must include user-facing text for the NSPhotoLibraryUsageDescription key, which the system displays when asking the user for access permission to their Photo Library.

For more information, please see Apple's documentation on Requesting Authorization to Access Photos.

Xcode setup

Under your project hierarchy in Xcode, open your Info.plist and add a new key "Privacy - Photo Library Usage Description". Set its value to "This allows us to access your camera roll so you can upload photos. Enable access from your app settings.".

Postprocess/Code setup

If you are instead using a postprocess script to run on your Unity project at compile-time, the following snippet can be used to append a value to the required NSPhotoLibraryUsageDescription key.

private const string PHOTO_LIBRARY_USAGE_DESCRIPTION = "This allows us to access your camera roll so you can upload photos. Enable access from your app settings.";
PlistElementDict rootDict = plist.root;rootDict.SetString("NSPhotoLibraryUsageDescription", PHOTO_LIBRARY_USAGE_DESCRIPTION);

PBXProject dependencies

The Zendesk SDK requires use of the Photos, AssetsLibrary, MobileCoreServices, and ImageIO frameworks.

Xcode setup

Under your project hierarchy in Xcode, select Build Settings > Linking > Other Linker Flags, and ensure the following Linker Flags are added to your project:

-weak_framework Photos-framework AssetsLibrary-framework MobileCoreServices-framework ImageIO
Postprocess/Code setup

You can use the following script to append all required frameworks to your PBXProject file:

pbxProject.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-weak_framework Photos");pbxProject.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-framework AssetsLibrary");pbxProject.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-framework MobileCoreServices");pbxProject.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-framework ImageIO");

Android dependencies

build.gradle dependencies

Update your project's build.gradle file and ensure the following are appended to your dependencies:

implementation fileTree(dir: 'libs', include: ['*.jar'])implementation 'androidx.appcompat:appcompat:1.0.2'

Sample build.gradle excerpt

dependencies {	implementation fileTree(dir: 'libs', include: ['*.jar'])	implementation 'androidx.appcompat:appcompat:1.0.2'**DEPS**}

Manifest dependencies

Update your project's AndroidManifest.xml application subsection with the following key:

<activity android:name="com.zendesk.gallery.Gallery" android:label=""/>