Search Unity

UnityAds folder in ios build without having the advertisement package

Discussion in 'Unity Ads & User Acquisition' started by mygameskwame, Feb 14, 2020.

  1. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    We need to make sure that we have not tracking or ads in our app for iOS since we it is for kids. But we got rejected multiple time for exactly that reason form Apple. After some digging i found that every build we created a UnityAds folder gets added in (Project/Classes) as well as a file DeviceSettings.mm, which links the /System/Library/Frameworks/AdSupport.framework and #include<AdSupport/ASIdentifierManager.h> Apple pointed out to us that we need to remove both if we want to complaint with their guidlines.
    To make sure it is not the issues of a plugin i create a fresh project made sure no services or advertisement package as included/installed. With the same result!

    I tried deleting the files with gave a me errors for xcode while compiling.
    Is there a way to remove that completely ?
     
  2. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Which Unity version?
     
  3. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    i am on 2019.3.1f1
     
  4. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Yes, also managed to reproduce issue in 2019.3.1f1 here. After building a empty project without Ads enabled, would have following files in the generated Xcode project:

    Code (CSharp):
    1. $ find . | grep UnityAds
    2. ./Builds/iOS/Classes/UnityAds
    3. ./Builds/iOS/Classes/UnityAds/UnityAdsConfig.h
    4. ./Builds/iOS/Classes/UnityAds/UnityAdsUnityWrapper.mm
    However, when deleting the Classes/UnityAds folder from within xcode, then I was able to compile project without problems. What error are you getting in that case?

    /Rasmus
     
  5. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    Apple Clang Error:
     
  6. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    Showing Recent Issues
    No such file or directory: '/Desktop/Unity/build Test/test for fw 6/Classes/UnityAds/UnityAdsUnityWrapper.mm'
     
  7. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Did you remove the folder from within Xcode, or just from command line?
     
  8. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    I removed it from the finder, i will try from xcode and comand line as well
     
  9. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    Removing it from Xcode seems to solve it! Will there be a fix for that or will the solution be to always remove it before building?
     
  10. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    samge goes for the DeviceSettings.mm file (also in the Classes folder) with the following problemetic code snippets:
    Code (CSharp):
    1. #include <sys/types.h>
    2. #include <sys/sysctl.h>
    3.  
    4. #include <AdSupport/ASIdentifierManager.h>
    5.  
    6. #include "DisplayManager.h"
    7.  
    8. // ad/vendor ids
    9.  
    10. static id QueryASIdentifierManager()
    11. {
    12.     NSBundle* bundle = [NSBundle bundleWithPath: @"/System/Library/Frameworks/AdSupport.framework"];
    13.     if (bundle)
    14.     {
    15.         [bundle load];
    16.         Class retClass = [bundle classNamed: @"ASIdentifierManager"];
    17.         return [retClass performSelector: @selector(sharedManager)];
    18.     }
    19.  
    20.     return nil;
    21. }
    22.  
    23. extern "C" const char* UnityAdvertisingIdentifier()
    24. {
    25.     static const char* _ADID = NULL;
    26.     static const NSString* _ADIDNSString = nil;
    27.  
    28.     // ad id can be reset during app lifetime
    29.     id manager = QueryASIdentifierManager();
    30.     if (manager)
    31.     {
    32.         NSString* adid = [[manager performSelector: @selector(advertisingIdentifier)] UUIDString];
    33.         // Do stuff to avoid UTF8String leaks. We still leak if ADID changes, but that shouldn't happen too often.
    34.         if (![_ADIDNSString isEqualToString: adid])
    35.         {
    36.             _ADIDNSString = adid;
    37.             free((void*)_ADID);
    38.             _ADID = AllocCString(adid);
    39.         }
    40.     }
    41.  
    42.     return _ADID;
    43. }
    44.  
    45. extern "C" int UnityGetLowPowerModeEnabled()
    46. {
    47.     return [[NSProcessInfo processInfo] isLowPowerModeEnabled] ? 1 : 0;
    48. }
    49.  
    50. extern "C" int UnityGetWantsSoftwareDimming()
    51. {
    52. #if !PLATFORM_TVOS
    53.     UIScreen* mainScreen = [UIScreen mainScreen];
    54.     return mainScreen.wantsSoftwareDimming ? 1 : 0;
    55. #else
    56.     return 0;
    57. #endif
    58. }
    59.  
    60. extern "C" void UnitySetWantsSoftwareDimming(int enabled)
    61. {
    62. #if !PLATFORM_TVOS
    63.     UIScreen* mainScreen = [UIScreen mainScreen];
    64.     mainScreen.wantsSoftwareDimming = enabled;
    65. #endif
    66. }
    67.  
    68. extern "C" int UnityAdvertisingTrackingEnabled()
    69. {
    70.     bool _AdTrackingEnabled = false;
    71.  
    72.     // ad tracking can be changed during app lifetime
    73.     id manager = QueryASIdentifierManager();
    74.     if (manager)
    75.         _AdTrackingEnabled = [manager performSelector: @selector(isAdvertisingTrackingEnabled)];
    76.  
    77.     return _AdTrackingEnabled ? 1 : 0;
    78. }
    79.  
     
  11. mygameskwame

    mygameskwame

    Joined:
    Oct 13, 2018
    Posts:
    11
    Since apple gave us this as problematic code for our rejection: WE also noticed that your kids app collects, transmits, or has the ability to share personal information or device information. Specifically, the app includes Unity SDK with dynamic use of the Ad Support framework including +[NSBundle bundleWithPath:] and -[NSBundle classNamed:] for strings "/System/Library/Frameworks/AdSupport.framework" and "ASIdentifierManager" as well as access the advertisingIdentifier. To resolve this issue, please revise your app so that no personally identifiable information or device information is sent to third parties.
     
  12. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Thanks for reporting. Yes, we have recently became aware of this change to Apple guidelines, and we are working actively on solving it.

    /Rasmus
     
  13. joengelm

    joengelm

    Joined:
    Apr 24, 2017
    Posts:
    2
    Hey Rasmus, has this been resolved in the latest version of Unity? I'm running into the same issue.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    joengelm likes this.