AWS in iOS not working

Hello,

I have setup AWS in my Unity game and it works fine in the editor and on Android but when I test it on iOS it doesn’t seem to access AWS properly.

I have added the NSAppTransportSecurity elements to my info.plist file but that doesn’t seem to help.

If it helps, the services I’m using are Cognito and SimpleDB.

This is the error I get from the Xcode debugger when trying to access AWS:

NullReferenceException: A null value was found where an object instance was required. at Amazon.AWSConfigs.get_LoggingConfig () [0x00000] in :0 at Amazon.Runtime.ClientConfig..ctor () [0x00000] in :0 at Amazon.CognitoIdentity.AmazonCognitoIdentityConfig..ctor () [0x00000] in :0 at Amazon.CognitoIdentity.AmazonCognitoIdentityClient..ctor (Amazon.Runtime.AWSCredentials credentials, Amazon.RegionEndpoint region) [0x00000] in :0 at Amazon.CognitoIdentity.CognitoAWSCredentials..ctor (System.String accountId, System.String identityPoolId, System.String unAuthRoleArn, System.String authRoleArn, Amazon.RegionEndpoint region) [0x00000] in :0 at GameControl.get_Credentials

This is how credentials is defined:

private CognitoAWSCredentials _credentials;

public CognitoAWSCredentials Credentials
{
    get
    {
        if (_credentials == null)
            _credentials = new CognitoAWSCredentials("IDENTITY_POOL_HERE", RegionEndpoint.APSoutheast2);
        return _credentials;
    }
}

Thanks for any help

I have fixed the problem with help from Unity support (Thanks Aurimas!)

In order to solve the issue, I had to add the following to my link.xml file.

The managed code stripper was removing types that were needed during compile time.

<linker>
    <assembly fullname="log4net" preserve="all"/>
    <assembly fullname="System.Configuration" preserve="all"/>

<assembly fullname = "System">
<type fullname = "System.ComponentModel.NullableConverter">
<method name = ".ctor">
</type> 
 <type fullname = "System.ComponentModel.ReferenceConverter">
<method signature = "System.Void .ctor(System.Type)" /> </type>
 </linker>

Not sure if it was switching to Mono from IL2CPP but here is my link.xml that is in the root folder (in case anyone needs it):

 <linker>
 
 <assembly fullname="UnityEngine">
     <type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
     <type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
 </assembly>
 
 <assembly fullname="mscorlib">
     <namespace fullname="System.Security.Cryptography" preserve="all"/>
 </assembly>
 
 <assembly fullname="System">
     <namespace fullname="System.Security.Cryptography" preserve="all"/>
 </assembly>
 
 <assembly fullname="AWSSDK.Core" preserve="all"/>
 <assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
 <assembly fullname="AWSSDK.SecurityToken" preserve="all"/>
 <assembly fullname="log4net" preserve="all"/>
 <assembly fullname="System.Configuration" preserve="all"/>

 <assembly fullname="AWSSDK.Core">
     <type fullname="Amazon.Util.Internal.PlatformServices.NetworkReachability" preserve="all"/>
    <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
 </assembly>
 <assembly fullname="AWSSDK.CognitoIdentity">
    <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
 </assembly>
 <assembly fullname="AWSSDK.SecurityToken">
    <namespace fullname="Amazon.Util.Internal.PlatformServices" preserve="all"/>
 </assembly>
 <assembly fullname="AWSSDK.DynamoDBv2" preserve="all"/>
 
 </linker>