Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom App Events work in iOS v13.7, but do not work in iOS v14+ #2145

Open
5 tasks done
codeconsole opened this issue Nov 12, 2022 · 4 comments
Open
5 tasks done

Custom App Events work in iOS v13.7, but do not work in iOS v14+ #2145

codeconsole opened this issue Nov 12, 2022 · 4 comments

Comments

@codeconsole
Copy link

codeconsole commented Nov 12, 2022

Checklist before submitting a bug report

Xcode version

Version 14.1 (14B47b)

Facebook iOS SDK version

14.1.0

Dependency Manager

CocoaPods

SDK Framework

Core

Goals

On iOS 14, Custom Events should be logged and show up as Test Events AppEvents.shared.logEvent(AppEvents.Name(CUSTOM_EVENT)) n the Events Manager using iOS 14+

If there is ANY issue with the event not being sent, it SHOULD SHOW UP IN THE LOGS

Expected results

After executing AppEvents.shared.logEvent(AppEvents.Name("applicationDidEnterBackground"))
the applicationDidEnterBackground event should show up in the Events Manager using iOS 14+

Why does it respond

FBSDKLog: Response <#1226>
Duration: 172 msec
Size: 11 kB
Response Body:
(
        {
        body =         {
            data =             (
            );
        };
        code = 200;
    }
)

when it doesn't work???

Actual results

The only events that show up are

fb_login_dialog_confirm_accept Automatically logged
fb_login_dialog_confirm_impression Automatically logged

If I run the SAME code on iOS 13.x, it works fine!

iOS 13.x debug :

2022-11-12 12:38:59.009105-0800 App[99687:13750481] FBSDKLog: Request <#1182>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
  Attachments:	
    include_headers:	false
    advertiser_id_collection_enabled:	1
    event:	CUSTOM_APP_EVENTS
    application_tracking_enabled:	1
    advertiser_id:	00000000-0000-0000-0000-000000000000
    ud:	{}
    sdk:	ios
    custom_events:	[{"0_auth_logger_id":"DCB9FCBE-F290-43D3-B753-FF18D1C2A819","3_method":"sfvc_auth","_inBackground":"1","1_timestamp_ms":1668285517167,"_ui":"Capacitor.CAPBridgeViewController","7_logging_token":"","_logTime":1668285517,"4_error_code":"","_implicitlyLogged":"1","6_extras":"{}","2_result":"success","_eventName":"fb_mobile_login_heartbeat","5_error_message":""}]
    format:	json
    extinfo:	["i2","org.codeconsole.testevents","1","1.0","13.7","x86_64","en_US","PST","NoCarrier",375,812,"3.00",10,926,354,"America\/Los_Angeles"]
    url_schemes:	["fb{{HIDDEN_APP_ID}}"]
    advertiser_tracking_enabled:	1
    access_token:	{{HIDDEN_ACCESS_TOKEN}}
    anon_id:	XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8
2022-11-12 12:38:59.009714-0800 App[99687:13750481] FBSDKLog: Request <#1182>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
2022-11-12 12:38:59.017131-0800 App[99687:13750481] [ProcessSuspension] 0x600002182c70 - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background
2022-11-12 12:38:59.018107-0800 App[99687:13750481] [ProcessSuspension] 0x600002182c70 - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background
2022-11-12 12:38:59.066116-0800 App[99687:13750481] FBSDKLog: FBSDKAppEvents: Recording event @ 1668285539.000000: {
    "_eventName" = applicationWillEnterForeground;
    "_inBackground" = 1;
    "_logTime" = 1668285539;
    "_ui" = "Capacitor.CAPBridgeViewController";
}
2022-11-12 12:38:59.077899-0800 App[99687:13750481] FBSDKLog: Request <#1186>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
  Attachments:	
    include_headers:	false
    advertiser_id_collection_enabled:	1
    event:	CUSTOM_APP_EVENTS
    application_tracking_enabled:	1
    advertiser_id:	00000000-0000-0000-0000-000000000000
    ud:	{}
    sdk:	ios
    custom_events:	[{"_eventName":"applicationWillEnterForeground","_logTime":1668285539,"_inBackground":"1","_ui":"Capacitor.CAPBridgeViewController"}]
    format:	json
    extinfo:	["i2","org.codeconsole.testevents","1","1.0","13.7","x86_64","en_US","PST","NoCarrier",375,812,"3.00",10,926,354,"America\/Los_Angeles"]
    url_schemes:	["fb{{HIDDEN_APP_ID}}"]
    advertiser_tracking_enabled:	1
    access_token:	{{HIDDEN_ACCESS_TOKEN}}
    anon_id:	XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8
2022-11-12 12:38:59.078514-0800 App[99687:13750481] FBSDKLog: Request <#1186>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
2022-11-12 12:38:59.567584-0800 App[99687:13752543] FBSDKLog: FBSDKGraphRequestConnection <#1189>:
  Duration: 558 msec
Response Size: 0 kB
  MIME type: application/json
2022-11-12 12:38:59.567901-0800 App[99687:13750481] FBSDKLog: Response <#1182>
Duration: 558 msec
Size: 16 kB
Response Body:
(
        {
        body =         {
            success = 1;
        };
        code = 200;
    }
)
2022-11-12 12:38:59.568119-0800 App[99687:13750481] FBSDKLog: FBSDKAppEvents: Flushed @ 1668285539.000000, 1 events due to 'Timer' - {
    "advertiser_id" = "00000000-0000-0000-0000-000000000000";
    "advertiser_id_collection_enabled" = 1;
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8";
    "application_tracking_enabled" = 1;
    "custom_events" = "[{\"0_auth_logger_id\":\"DCB9FCBE-F290-43D3-B753-FF18D1C2A819\",\"3_method\":\"sfvc_auth\",\"_inBackground\":\"1\",\"1_timestamp_ms\":1668285517167,\"_ui\":\"Capacitor.CAPBridgeViewController\",\"7_logging_token\":\"\",\"_logTime\":1668285517,\"4_error_code\":\"\",\"_implicitlyLogged\":\"1\",\"6_extras\":\"{}\",\"2_result\":\"success\",\"_eventName\":\"fb_mobile_login_heartbeat\",\"5_error_message\":\"\"}]";
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"org.codeconsole.testevents\",\"1\",\"1.0\",\"13.7\",\"x86_64\",\"en_US\",\"PST\",\"NoCarrier\",375,812,\"3.00\",10,926,354,\"America\\/Los_Angeles\"]";
    ud = "{}";
    "url_schemes" = "[\"fb{{HIDDEN_APP_ID}}\"]";
}
Events: [
  {
    "event" : {
      "0_auth_logger_id" : "DCB9FCBE-F290-43D3-B753-FF18D1C2A819",
      "3_method" : "sfvc_auth",
      "_inBackground" : "1",
      "1_timestamp_ms" : 1668285517167,
      "_ui" : "Capacitor.CAPBridgeViewController",
      "7_logging_token" : "",
      "_logTime" : 1668285517,
      "4_error_code" : "",
      "_implicitlyLogged" : "1",
      "6_extras" : "{}",
      "2_result" : "success",
      "_eventName" : "fb_mobile_login_heartbeat",
      "5_error_message" : ""
    },
    "isImplicit" : true
  }
]
Flush Result : Success
2022-11-12 12:38:59.572461-0800 App[99687:13752546] FBSDKLog: FBSDKGraphRequestConnection <#1192>:
  Duration: 494 msec
Response Size: 0 kB
  MIME type: application/json
2022-11-12 12:38:59.572716-0800 App[99687:13750481] FBSDKLog: Response <#1186>
Duration: 494 msec
Size: 16 kB
Response Body:
(
        {
        body =         {
            success = 1;
        };
        code = 200;
    }
)
2022-11-12 12:38:59.573044-0800 App[99687:13750481] FBSDKLog: FBSDKAppEvents: Flushed @ 1668285539.000000, 1 events due to 'Explicit' - {
    "advertiser_id" = "00000000-0000-0000-0000-000000000000";
    "advertiser_id_collection_enabled" = 1;
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8";
    "application_tracking_enabled" = 1;
    "custom_events" = "[{\"_eventName\":\"applicationWillEnterForeground\",\"_logTime\":1668285539,\"_inBackground\":\"1\",\"_ui\":\"Capacitor.CAPBridgeViewController\"}]";
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"org.codeconsole.testevents\",\"1\",\"1.0\",\"13.7\",\"x86_64\",\"en_US\",\"PST\",\"NoCarrier\",375,812,\"3.00\",10,926,354,\"America\\/Los_Angeles\"]";
    ud = "{}";
    "url_schemes" = "[\"fb{{HIDDEN_APP_ID}}\"]";
}
Events: [
  {
    "event" : {
      "_eventName" : "applicationWillEnterForeground",
      "_logTime" : 1668285539,
      "_inBackground" : "1",
      "_ui" : "Capacitor.CAPBridgeViewController"
    },
    "isImplicit" : false
  }
]
Flush Result : Success

iOS 14.x debug:

2022-11-12 12:38:59.009105-0800 App[99687:13750481] FBSDKLog: Request <#1182>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
  Attachments:	
    include_headers:	false
    advertiser_id_collection_enabled:	1
    event:	CUSTOM_APP_EVENTS
    application_tracking_enabled:	1
    advertiser_id:	00000000-0000-0000-0000-000000000000
    ud:	{}
    sdk:	ios
    custom_events:	[{"0_auth_logger_id":"DCB9FCBE-F290-43D3-B753-FF18D1C2A819","3_method":"sfvc_auth","_inBackground":"1","1_timestamp_ms":1668285517167,"_ui":"Capacitor.CAPBridgeViewController","7_logging_token":"","_logTime":1668285517,"4_error_code":"","_implicitlyLogged":"1","6_extras":"{}","2_result":"success","_eventName":"fb_mobile_login_heartbeat","5_error_message":""}]
    format:	json
    extinfo:	["i2","org.codeconsole.testevents","1","1.0","13.7","x86_64","en_US","PST","NoCarrier",375,812,"3.00",10,926,354,"America\/Los_Angeles"]
    url_schemes:	["fb{{HIDDEN_APP_ID}}"]
    advertiser_tracking_enabled:	1
    access_token:	{{HIDDEN_ACCESS_TOKEN}}
    anon_id:	XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8
2022-11-12 12:38:59.009714-0800 App[99687:13750481] FBSDKLog: Request <#1182>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
2022-11-12 12:38:59.017131-0800 App[99687:13750481] [ProcessSuspension] 0x600002182c70 - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background
2022-11-12 12:38:59.018107-0800 App[99687:13750481] [ProcessSuspension] 0x600002182c70 - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background
2022-11-12 12:38:59.066116-0800 App[99687:13750481] FBSDKLog: FBSDKAppEvents: Recording event @ 1668285539.000000: {
    "_eventName" = applicationWillEnterForeground;
    "_inBackground" = 1;
    "_logTime" = 1668285539;
    "_ui" = "Capacitor.CAPBridgeViewController";
}
2022-11-12 12:38:59.077899-0800 App[99687:13750481] FBSDKLog: Request <#1186>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
  Attachments:	
    include_headers:	false
    advertiser_id_collection_enabled:	1
    event:	CUSTOM_APP_EVENTS
    application_tracking_enabled:	1
    advertiser_id:	00000000-0000-0000-0000-000000000000
    ud:	{}
    sdk:	ios
    custom_events:	[{"_eventName":"applicationWillEnterForeground","_logTime":1668285539,"_inBackground":"1","_ui":"Capacitor.CAPBridgeViewController"}]
    format:	json
    extinfo:	["i2","org.codeconsole.testevents","1","1.0","13.7","x86_64","en_US","PST","NoCarrier",375,812,"3.00",10,926,354,"America\/Los_Angeles"]
    url_schemes:	["fb{{HIDDEN_APP_ID}}"]
    advertiser_tracking_enabled:	1
    access_token:	{{HIDDEN_ACCESS_TOKEN}}
    anon_id:	XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8
2022-11-12 12:38:59.078514-0800 App[99687:13750481] FBSDKLog: Request <#1186>:
  URL:	https://graph.facebook.com/v14.0/{{HIDDEN_APP_ID}}/activities
  Method:	POST
  UserAgent:	FBiOSSDK.14.1.0
  MIME:	application/json
2022-11-12 12:38:59.567584-0800 App[99687:13752543] FBSDKLog: FBSDKGraphRequestConnection <#1189>:
  Duration: 558 msec
Response Size: 0 kB
  MIME type: application/json
2022-11-12 12:38:59.567901-0800 App[99687:13750481] FBSDKLog: Response <#1182>
Duration: 558 msec
Size: 16 kB
Response Body:
(
        {
        body =         {
            success = 1;
        };
        code = 200;
    }
)
2022-11-12 12:38:59.568119-0800 App[99687:13750481] FBSDKLog: FBSDKAppEvents: Flushed @ 1668285539.000000, 1 events due to 'Timer' - {
    "advertiser_id" = "00000000-0000-0000-0000-000000000000";
    "advertiser_id_collection_enabled" = 1;
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8";
    "application_tracking_enabled" = 1;
    "custom_events" = "[{\"0_auth_logger_id\":\"DCB9FCBE-F290-43D3-B753-FF18D1C2A819\",\"3_method\":\"sfvc_auth\",\"_inBackground\":\"1\",\"1_timestamp_ms\":1668285517167,\"_ui\":\"Capacitor.CAPBridgeViewController\",\"7_logging_token\":\"\",\"_logTime\":1668285517,\"4_error_code\":\"\",\"_implicitlyLogged\":\"1\",\"6_extras\":\"{}\",\"2_result\":\"success\",\"_eventName\":\"fb_mobile_login_heartbeat\",\"5_error_message\":\"\"}]";
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"org.codeconsole.testevents\",\"1\",\"1.0\",\"13.7\",\"x86_64\",\"en_US\",\"PST\",\"NoCarrier\",375,812,\"3.00\",10,926,354,\"America\\/Los_Angeles\"]";
    ud = "{}";
    "url_schemes" = "[\"fb{{HIDDEN_APP_ID}}\"]";
}
Events: [
  {
    "event" : {
      "0_auth_logger_id" : "DCB9FCBE-F290-43D3-B753-FF18D1C2A819",
      "3_method" : "sfvc_auth",
      "_inBackground" : "1",
      "1_timestamp_ms" : 1668285517167,
      "_ui" : "Capacitor.CAPBridgeViewController",
      "7_logging_token" : "",
      "_logTime" : 1668285517,
      "4_error_code" : "",
      "_implicitlyLogged" : "1",
      "6_extras" : "{}",
      "2_result" : "success",
      "_eventName" : "fb_mobile_login_heartbeat",
      "5_error_message" : ""
    },
    "isImplicit" : true
  }
]
Flush Result : Success
2022-11-12 12:38:59.572461-0800 App[99687:13752546] FBSDKLog: FBSDKGraphRequestConnection <#1192>:
  Duration: 494 msec
Response Size: 0 kB
  MIME type: application/json
2022-11-12 12:38:59.572716-0800 App[99687:13750481] FBSDKLog: Response <#1186>
Duration: 494 msec
Size: 16 kB
Response Body:
(
        {
        body =         {
            success = 1;
        };
        code = 200;
    }
)
2022-11-12 12:38:59.573044-0800 App[99687:13750481] FBSDKLog: FBSDKAppEvents: Flushed @ 1668285539.000000, 1 events due to 'Explicit' - {
    "advertiser_id" = "00000000-0000-0000-0000-000000000000";
    "advertiser_id_collection_enabled" = 1;
    "advertiser_tracking_enabled" = 1;
    "anon_id" = "XZBADCE632-EECF-4526-A0D8-8FBD0E8B9FC8";
    "application_tracking_enabled" = 1;
    "custom_events" = "[{\"_eventName\":\"applicationWillEnterForeground\",\"_logTime\":1668285539,\"_inBackground\":\"1\",\"_ui\":\"Capacitor.CAPBridgeViewController\"}]";
    event = "CUSTOM_APP_EVENTS";
    extinfo = "[\"i2\",\"org.codeconsole.testevents\",\"1\",\"1.0\",\"13.7\",\"x86_64\",\"en_US\",\"PST\",\"NoCarrier\",375,812,\"3.00\",10,926,354,\"America\\/Los_Angeles\"]";
    ud = "{}";
    "url_schemes" = "[\"fb{{HIDDEN_APP_ID}}\"]";
}
Events: [
  {
    "event" : {
      "_eventName" : "applicationWillEnterForeground",
      "_logTime" : 1668285539,
      "_inBackground" : "1",
      "_ui" : "Capacitor.CAPBridgeViewController"
    },
    "isImplicit" : false
  }
]
Flush Result : Success

Steps to reproduce

  1. Install iOS 13.7 Simulator
  2. Install iOS 14.5 Sinulator
  3. Download the Example
git clone https://github.com/codeconsole/fbTestEvents
cd fbTestEvents
  1. Update FB_APP_ID, FB_APP_ID, and FB_APP_ID in ios/App/App/Info.plist or run ./setupOSX.sh if on a Mac

  2. Build the Example

npm install
npm build
  1. Visit Event Manager for App and Choose Test Events tab.
  2. Run the Example on iOS 13.7 Simulator
npx cap run ios
  1. Log in with FB, then exit app and come back, notice events are fired
  2. Run the Example on iOS 14.5 Simulator
npx cap run ios
  1. Log in with FB, then exit app and come back, notice events are NOT fired

Code samples & details

`AppDelegate.swift`

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
        AppEvents.shared.logEvent(AppEvents.Name("applicationWillEnterForeground"))
        AppEvents.shared.flush()
    }
@codeconsole
Copy link
Author

#2085

@codeconsole
Copy link
Author

Ok, this is ridiculous and it all came down to the Facebook App "Allow tracking" setting on my iPhone?!?
What does that have to do with running in the simulator where there is no Facebook App?
What does that have to do with custom events? Why do fb_login_dialog_accept Automatically logged
fb_login_dialog_confirm_impression Automatically work either way??

AND MOST IMPORTANTLY
why does

Response Body:
(
        {
        body =         {
            success = 1;
        };
        code = 200;
    }
)

the response return successful?
Why isn't this properly documented?? Why isn't there some sort of error ANYWHERE?

@codeconsole
Copy link
Author

AT THE VERY LEAST THERE SHOULD BE AN API CALL TO DETERMINE IF THE USER ALLOWS FACEBOOK APP TRACKING

@codeconsole
Copy link
Author

If there is a permission issue with determining the use allowed App Tracking, the Response should still not return OK / 200 iF THE USER IS A TEST USER OR IS AN OWNER OF THE APP. If the user is a Test User or Owner of the App, it should return an error and state that the User does not have Tracking enabled on the Facebook app so Events are disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant