app rejected because of advertisingIdentifier in Facebook SDK and Flurry SDK
Asked Answered
L

4

23

My app was rejected because of advertisingIdentifier in Facebook sdk and Flurry SDK ! I found an occurrence of advertisingIdentifier in the latest Facebook SDK (3.12) and Flurry SDK. Maybe you can check your library's for an occurence with the method below:

I opened the FacebookSDK.framework as a library in the terminal and typed the following command

otool -v -s __TEXT __objc_methname FacebookSDK | grep advertisingIdentifier

and the same way for Flurry SDK.

But I don't know what to do.?

For news: Flurry has recently updated their SDK and it doesn't contain the advertisingIdentifier, but Facebook didn't yet.

Laughable answered 5/2, 2014 at 10:30 Comment(5)
Isn't advertisingIdentifier the accessor you're supposed to use (assuming iOS6 +)?Blanding
Recently the advertisingIdentifier use has been banned if you are not actually showing ads (and just use it for tracking instead).Liebfraumilch
but in my app i don't want use any Ad!Laughable
Here is the issue: github.com/facebook/facebook-ios-sdk/issues/583Waac
for news: Flurry has update their SDK that not contain the "advertisingIdentifier"Laughable
R
13

Get the source code from https://github.com/facebook/facebook-ios-sdk , instead of the compiled framework. Just deleting the framework and pasting in the source code should do it.

Go to FBUtility.m and modify this method:

+ (NSString *)advertiserID {
    NSString *advertiserID = nil;
    Class ASIdentifierManagerClass = [FBDynamicFrameworkLoader loadClass:@"ASIdentifierManager" withFramework:@"AdSupport"];
    if ([ASIdentifierManagerClass class]) {
        ASIdentifierManager *manager = [ASIdentifierManagerClass sharedManager];
        advertiserID = [[manager advertisingIdentifier] UUIDString];
    }
    return advertiserID;
}

to

+ (NSString *)advertiserID {
   return @"";
}
Radicle answered 5/2, 2014 at 11:5 Comment(23)
Does this mean that every apps embedding facebook sdk 3.12 will get rejected because of the piece of code?Pyotr
It really depends on Apple's review team. They do miss things from time to time, but the short answer is probably yes. If you display ads - you'll be fine, though.Radicle
So Facebook and its sdk assumes every one wants to display ads? Seems weird to me.Pyotr
No, it doesn't. It uses the advertiser identifier only if the setting in Settings isn't limiting its use and even then it's using it for what I assume are valid reasons (like install tracking). The issue here is that Apple wants this identifier used only for the purposes of advertising and if you don't have ads in your app, that means that you're not using it for its intended purpose, hence your app is rejected.Radicle
I understand that. But here the advertisingIdentifier is potentially not used at all if I, for example, just retrieve the user's friends list. Despite that my app would be rejected because I include a third party library that make use of this identifier under certain circumstances. Or do I miss something here?Pyotr
Yeah, that's right. Although it's against the Appstore rules, this rule wasn't enforced up until a week ago, so from Facebook's point of view (and a lot of other SDK providers) it was perfectly fine to use it. I do expect them to update their code fairly soon, though.Radicle
I download the code and made the changes as specified in FBUtility.m and from scripts i build the script for framework again,then i replaced the framework in my code again. This should work right?Luffa
i again tried with the command "grep -r advertisingIdentifier ." it was not showing any matchesLuffa
Yeah, that should do it as well. To make sure you can set a symbolic breakpoint on advertisingIdentifier and see if it gets hit.Radicle
@Andrew, do you know if there's a solution for Facebook SDK for Unity? FacebookSDK.a is referencing ASIndentifierManager. I can't seem to find any.Tribble
Sure, get the ios sdk source code from my answer (make sure to go to the 3.11 release, since that's the on the Unity sdk is based on), go through the procedure to remove the identifier, then compile the iOS library (the .a), it'll generate a libfacebook_ios_sdk.a file, rename it to FacebookSDK.a and replace the one from the Unity package with the new one. Let me know if it works or if you need help with it.Radicle
Was someone's app approved using this method ? I'm frustrated, one of my apps got approved with FB 3.11, one rejected.Belsky
One of my apps got approved yesterday using this method.Radicle
How do you compile the IOS library after removing the item?Pochard
After changing the code in FBUtility? Either use the raw source code or use Facebook's project that has a scheme that compiles the library.Radicle
@Andrew, I managed to generate the libfacebook_ios_sdk.a. But how can I update the FB files in Unity because they would no longer match the ones from the library, correct? The iOS SDK has a different folder-ing. I'm afraid we had an older Unity SDK(v4.2.4). We didn't update it since they move around the files. We only use FB for login and nothing else and has been working with the 4.2.4 version. Does this mean we have to update first the FB Unity SDK to latest before we can use the library from iOS SDK v3.11?Tribble
Following this solution, I just downloaded the official Facebook SDK sources on their GitHub repository and compiled them back. You can find the build via this article.Rochellerochemont
I'm having trouble on compiling the library with the modified class. Does anyone that has it fixed could please send me a download link to it?Aestivation
github.com/akmarinov/facebook-ios-sdk/blob/master/product/… is the compiled library, github.com/akmarinov/facebook-ios-sdk/tree/master/product/… contains the header files that you'll needRadicle
My bad. I freaking missed it :P Thanks a lot! That did the trick.Aestivation
That lib is meant to work with any architecture (device/simulator) ?Aestivation
I haven't touched FB's settings, so it should be, are you having any issues?Radicle
Let us continue this discussion in chat.Aestivation
B
18

Update:

Since answering below I have submitted the app to the store, but with the edits suggested below Facebook is able only to track events without doing installation attribution tracking. Thus the problem with the solution below is that it effectively forbids Facebook to link installations to ad campaigngs on facebook.

A fix for this should be using the latest 3.13 Facebook SDK and simply removing the

-weak_framework AdSupport 

from your project as suggested below.

The app now compiles correctly without editing FBUtil.m and it does not link the AdSupport framework is removed from Pods.xconfig and Pods-Facebook-iOS-SDK.xconfig

I left the reply below so that you can see my previous attempt to remove AdSupport from the 3.12 version of the SDK, but DO NOT USE IT if you want to do install ads attribution tracking. (In fact you can use it only if you plan to do CPC ads, otherwise facebook will not be able to optimize the install ads campaigns).

OLD REPLY:

This seemed to be not enough in my case. To be sure, I wanted to remove the AdSupport Framework completely. In the Facebook SDK 3.12 the AdSupport Framework seems to be ALWAYS imported/linked even if it's not included in your project or pod file (in fact I am using cocoapods to install Facebook SDK).

The AdSupport framework was indeed not linked in my project but executing an "otool -L" on my app executable was showing that the framework was still being linked.

In order to avoid the current FB SDK to do that you need to edit the following:

In FBUtility.m

Comment this:

//#import <AdSupport/AdSupport.h>

Edit the following methods:

+ (NSString *)advertiserID {
    /*
    NSString *advertiserID = nil;
    Class ASIdentifierManagerClass = [FBDynamicFrameworkLoader loadClass:@"ASIdentifierManager" withFramework:@"AdSupport"];
    if ([ASIdentifierManagerClass class]) {
        ASIdentifierManager *manager = [ASIdentifierManagerClass sharedManager];
        advertiserID = [[manager advertisingIdentifier] UUIDString];
    }
    return advertiserID;
    */
    return @"";
}

+ (FBAdvertisingTrackingStatus)advertisingTrackingStatus {

    /*
    if ([FBSettings restrictedTreatment] == FBRestrictedTreatmentYES) {
        return AdvertisingTrackingDisallowed;
    }
    FBAdvertisingTrackingStatus status = AdvertisingTrackingUnspecified;
    Class ASIdentifierManagerClass = [FBDynamicFrameworkLoader loadClass:@"ASIdentifierManager" withFramework:@"AdSupport"];
    if ([ASIdentifierManagerClass class]) {
        ASIdentifierManager *manager = [ASIdentifierManagerClass sharedManager];
        if (manager) {
            status = [manager isAdvertisingTrackingEnabled] ? AdvertisingTrackingAllowed : AdvertisingTrackingDisallowed;
        }
    }
    */
    return AdvertisingTrackingDisallowed;
}

Finally if you're using cocoapods search in your project workspace all the

-weak_framework AdSupport

And delete all of those (you'll find those in Pods.xconfig and Pods-Facebook-iOS-SDK.xcconfig)

This has worked for me and now my app executable is free from AdSupport.

Blurb answered 28/2, 2014 at 17:51 Comment(3)
"-weak_framework AdSupport" will come back the next time you run pod update. I added the following script to build phase to fix it automatically: sed -i bak "s/ -weak_framework AdSupport//" Pods/*.xcconfig It doesn't work for the first build after pod update though, so don't archive immediately after pod update.Forbidden
I tried using the FB SDK provided here github.com/facebook/facebook-ios-sdk. Unfrotunately the code doesn't seem to be ARC based and it's throwing retain, release errors. Any other code base I can use or how can I fix this? Thank you!Shondrashone
i create last version of command for fix pod update: find Pods/. -name "*.xcconfig" -type f -print0 | xargs -0 sed -i '' -e "s/-framework\ \"AdSupport\"//" -e "s/-framework\ \"iAd\"//g"Seine
R
13

Get the source code from https://github.com/facebook/facebook-ios-sdk , instead of the compiled framework. Just deleting the framework and pasting in the source code should do it.

Go to FBUtility.m and modify this method:

+ (NSString *)advertiserID {
    NSString *advertiserID = nil;
    Class ASIdentifierManagerClass = [FBDynamicFrameworkLoader loadClass:@"ASIdentifierManager" withFramework:@"AdSupport"];
    if ([ASIdentifierManagerClass class]) {
        ASIdentifierManager *manager = [ASIdentifierManagerClass sharedManager];
        advertiserID = [[manager advertisingIdentifier] UUIDString];
    }
    return advertiserID;
}

to

+ (NSString *)advertiserID {
   return @"";
}
Radicle answered 5/2, 2014 at 11:5 Comment(23)
Does this mean that every apps embedding facebook sdk 3.12 will get rejected because of the piece of code?Pyotr
It really depends on Apple's review team. They do miss things from time to time, but the short answer is probably yes. If you display ads - you'll be fine, though.Radicle
So Facebook and its sdk assumes every one wants to display ads? Seems weird to me.Pyotr
No, it doesn't. It uses the advertiser identifier only if the setting in Settings isn't limiting its use and even then it's using it for what I assume are valid reasons (like install tracking). The issue here is that Apple wants this identifier used only for the purposes of advertising and if you don't have ads in your app, that means that you're not using it for its intended purpose, hence your app is rejected.Radicle
I understand that. But here the advertisingIdentifier is potentially not used at all if I, for example, just retrieve the user's friends list. Despite that my app would be rejected because I include a third party library that make use of this identifier under certain circumstances. Or do I miss something here?Pyotr
Yeah, that's right. Although it's against the Appstore rules, this rule wasn't enforced up until a week ago, so from Facebook's point of view (and a lot of other SDK providers) it was perfectly fine to use it. I do expect them to update their code fairly soon, though.Radicle
I download the code and made the changes as specified in FBUtility.m and from scripts i build the script for framework again,then i replaced the framework in my code again. This should work right?Luffa
i again tried with the command "grep -r advertisingIdentifier ." it was not showing any matchesLuffa
Yeah, that should do it as well. To make sure you can set a symbolic breakpoint on advertisingIdentifier and see if it gets hit.Radicle
@Andrew, do you know if there's a solution for Facebook SDK for Unity? FacebookSDK.a is referencing ASIndentifierManager. I can't seem to find any.Tribble
Sure, get the ios sdk source code from my answer (make sure to go to the 3.11 release, since that's the on the Unity sdk is based on), go through the procedure to remove the identifier, then compile the iOS library (the .a), it'll generate a libfacebook_ios_sdk.a file, rename it to FacebookSDK.a and replace the one from the Unity package with the new one. Let me know if it works or if you need help with it.Radicle
Was someone's app approved using this method ? I'm frustrated, one of my apps got approved with FB 3.11, one rejected.Belsky
One of my apps got approved yesterday using this method.Radicle
How do you compile the IOS library after removing the item?Pochard
After changing the code in FBUtility? Either use the raw source code or use Facebook's project that has a scheme that compiles the library.Radicle
@Andrew, I managed to generate the libfacebook_ios_sdk.a. But how can I update the FB files in Unity because they would no longer match the ones from the library, correct? The iOS SDK has a different folder-ing. I'm afraid we had an older Unity SDK(v4.2.4). We didn't update it since they move around the files. We only use FB for login and nothing else and has been working with the 4.2.4 version. Does this mean we have to update first the FB Unity SDK to latest before we can use the library from iOS SDK v3.11?Tribble
Following this solution, I just downloaded the official Facebook SDK sources on their GitHub repository and compiled them back. You can find the build via this article.Rochellerochemont
I'm having trouble on compiling the library with the modified class. Does anyone that has it fixed could please send me a download link to it?Aestivation
github.com/akmarinov/facebook-ios-sdk/blob/master/product/… is the compiled library, github.com/akmarinov/facebook-ios-sdk/tree/master/product/… contains the header files that you'll needRadicle
My bad. I freaking missed it :P Thanks a lot! That did the trick.Aestivation
That lib is meant to work with any architecture (device/simulator) ?Aestivation
I haven't touched FB's settings, so it should be, are you having any issues?Radicle
Let us continue this discussion in chat.Aestivation
C
2

Just read this:

https://developers.facebook.com/bugs/242477629268301/

No code changes required.

Carver answered 16/1, 2016 at 8:8 Comment(1)
Whole thread is long. Go straight to this comment from FB for solution: developers.facebook.com/bugs/242477629268301/…Waxbill
T
0

You must delete Facebook-SDK as a bundle version on your project folder and then create a cocoapods and connect last version of these;

 pod 'FBSDKCoreKit'
 pod 'FBSDKShareKit'
 pod 'FBSDKLoginKit'
Tennes answered 15/7, 2015 at 9:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.