"Flush Result : No Connectivity" Error for FBSDKAppEvents - ios

I have integrated FBSDKCoreKit.framework to track app events, I am calling [FBSDKAppEvents activateApp] in applicationDidBecomeActive: and enabling logs using [FBSDKSettings enableLoggingBehavior:FBSDKLoggingBehaviorAppEvents]
In logs it's logging following error
FBSDKLog: FBSDKAppEvents: Flushed # 1473666575, 2 events due to 'Timer' - {
"advertiser_tracking_enabled" = 1;
"anon_id" = "xxxxxx-xxxxx-xxxxx-xxxxx";
"application_tracking_enabled" = 1;
event = "CUSTOM_APP_EVENTS";
extinfo = "[xxx, xxx, xxx]";
"url_schemes" = "[\"xxxxxxxx\"]";
}
Events: [
{
"isImplicit" : false,
"event" : {
"fb_mobile_launch_source" : "Unclassified",
"_session_id" : "xxxxxx-xxxxx-xxxxx-xxxxx",
"fb_mobile_app_interruptions" : 0,
"_logTime" : 1473664599,
"_ui" : "no_ui",
"_eventName" : "fb_mobile_deactivate_app",
"_valueToSum" : 155,
"fb_mobile_time_between_sessions" : "session_quanta_2"
}
},
{
"isImplicit" : false,
"event" : {
"fb_mobile_launch_source" : "Unclassified",
"_ui" : "no_ui",
"_eventName" : "fb_mobile_activate_app",
"_logTime" : 1473665765,
"_session_id" : "96FA9509-AB21-475F-9F44-3005FE5D10BC"
}
}
]
Flush Result : No Connectivity
At end of log it's showing me error Flush Result : No Connectivity
Any one know why I'm getting this error ?

I got it working by following this guide FBSDK doc here does not explain about each configuration required for tracking events

Related

Reading data from Firebase RTDB using Flutter has different behavior on Android and iOS

I'm experiencing a behavior where the following call behaves differently when executed for iOS and for Android.
In Android, the following .get() call returns the expected snapshot from the chatRoomID path. However, in iOS, .get() ends up returning a snapshot of the whole node under myUser.userID.
It seems for iOS, the second child node path is disregarded...
DataSnapshot snapshot = await chatsRef
.child(myUser.userID!)
.child(chatRoomID)
.get();
print(snapshot.value);
JSON:
{
"chats" : {
"oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : {
"c00dca80-9077-11ec-855a-910961fc4253" : {
"chatAdmin" : "oF1b6J4Hz3NGzRb9RmSVFGJdcYi1",
"chatImage" : "https://images.pexels.com/photos/887827/pexels-photo-887827.jpeg?auto=compress&cs=tinysrgb&h=650&w=940",
"chatName" : "chef",
"chatRoomID" : "c00dca80-9077-11ec-855a-910961fc4253",
"isActivityChat" : false,
"isGroupChat" : true,
"lastMessage" : {
"lastMessage" : "Hey",
"lastMessageTime" : "2022-02-18 00:00:56.992308",
"messageID" : "-MwAC5BUz3GKPmkA1SSQ",
"nKDsrLrcU0PgtEDV5tKpMumSDuu1" : "true",
"oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : "false",
"psJQRp96VGWIjTDpNpMUShPNWa82" : "true",
"sendBy" : "oF1b6J4Hz3NGzRb9RmSVFGJdcYi1",
"senderName" : "Emily"
},
"muted" : {
"nKDsrLrcU0PgtEDV5tKpMumSDuu1" : false,
"oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : false,
"psJQRp96VGWIjTDpNpMUShPNWa82" : false
},
"users" : {
"nKDsrLrcU0PgtEDV5tKpMumSDuu1" : true,
"oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : true,
"psJQRp96VGWIjTDpNpMUShPNWa82" : true
}
},
"nKDsrLrcU0PgtEDV5tKpMumSDuu1_oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : {
"chatRoomID" : "nKDsrLrcU0PgtEDV5tKpMumSDuu1_oF1b6J4Hz3NGzRb9RmSVFGJdcYi1",
"isActivityChat" : false,
"isGroupChat" : false,
"lastMessage" : {
"lastMessage" : "Shut",
"lastMessageTime" : "2022-02-18 00:01:30.161511",
"messageID" : "-MwACDHlTWpQhhQFh9k8",
"nKDsrLrcU0PgtEDV5tKpMumSDuu1" : "true",
"oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : "false",
"sendBy" : "oF1b6J4Hz3NGzRb9RmSVFGJdcYi1",
"senderName" : "Emily"
},
"muted" : {
"nKDsrLrcU0PgtEDV5tKpMumSDuu1" : false,
"oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : false
},
"users" : {
"nKDsrLrcU0PgtEDV5tKpMumSDuu1" : true,
"oF1b6J4Hz3NGzRb9RmSVFGJdcYi1" : true
}
}
}
},
}
As discussed in the comments
You should be getting the same behavior on both iOS and Android, as the underlying SDKs should work the same on those platforms. That said, since the FlutterFire libraries wrap the native SDKs and the get() API is relatively new, it might be that there is an unintended difference between how the iOS and Android SDKs implement it.
If that is indeed the case, you might want try and see if once() works for you. While it has an annoying side-effect in an edge-case (see here), the once API itself is much older, so more likely to be stable across platforms.
Update: I'm having a really hard time reproducing the problem. I've imported your JSON into a database of mine, and then run this code on startup of my app:
FirebaseDatabase database = FirebaseDatabase.instance;
var chatsRef = database.ref('71163140/chats');
var threadRef = chatsRef.child('oF1b6J4Hz3NGzRb9RmSVFGJdcYi1').child('nKDsrLrcU0PgtEDV5tKpMumSDuu1_oF1b6J4Hz3NGzRb9RmSVFGJdcYi1');
DataSnapshot snapshot = await threadRef.get();
if (snapshot.value != null) {
print('get: ${snapshot.value}');
}
DatabaseEvent event = await threadRef.once();
if (event.snapshot.value != null) {
print('once: ${event.snapshot.value}');
}
So it reads a single chat thread out of the data you shared with both get() and once(), and then prints what it gets. Both on iOS and Android, I never see the c00dca80-9077-11ec-855a-910961fc4253 thread showing up in my output, I only get the chat thread where "isGroupChat" : false,.
Can you update the code or data in your question to show how I can get the same faulty result as you get?

youtube data api not working with videorecordingdetails - show error 400 unexpectedPart

When I include VideoRecordingDetails while inserting a video through youtube data api, it shows me the below error:-
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "youtube.part",
"location" : "part",
"locationType" : "parameter",
"message" : "{0}",
"reason" : "unexpectedPart"
} ],
"message" : "{0}"
}
But after commenting the below line, its working fine.
ytvideo.setRecordingDetails(recordingDetails);
Please help me how I can set recording date of a video. Here is my code which is not working:-
VideoRecordingDetails recordingDetails = new VideoRecordingDetails();
DateTime dt = new DateTime(vdata.getYtRecordDate());
recordingDetails.setRecordingDate(dt);
ytvideo.setRecordingDetails(recordingDetails);

Delete all Data belonging to user

I am rebuilding a social media app like Instagram.
My user can decide to delete their account and then I would like to automatically delete all things belonging to the user.
Most of the stuff I can delete easily, but things like posts is where I struggle because the uid is just a sub child of the key where the post is saved into.
My Database tree:
"Feed" : {
"es5fIbnKFpX4szcCbroUqHjJg6E3" : {
"-KjTBFFE5QzktG1IT5u0" : true,
"-KjTHFNe1RRS8Ly6bKsA" : true,
"-KjY30xwWA2IJBwlvyzf" : true
}
"myPosts" : {
"jlkRoaucY6Q4GBkzhor5yAAl97I2" : {
"-KjTBFFE5QzktG1IT5u0" : true,
"-KjTHFNe1RRS8Ly6bKsA" : true,
"-KjY30xwWA2IJBwlvyzf" : true
}
"posts" : {
"-KjTBFFE5QzktG1IT5u0" : {
"bookmarkCount" : 0,
"caption" : "Toll",
"commentCount" : 1,
"creationDate" : 1.494081403379004E9,
"hoursSinceUpload" : 0,
"likeCount" : 0,
"photoUrl" : "https://firebasestorage.googleapis.com/v0/b/funcloud-8e84e.appspot.com/o/Posts%2F76192CBE-55F0-4907-889A-849E196D5796?alt=media&token=de675609-4b73-411d-b402-f1ff3db64f79",
"ratio" : 1.502732240437158,
"score" : 16.38698994684219,
"uid" : "jlkRoaucY6Q4GBkzhor5yAAl97I2"
},
"-KjTHFNe1RRS8Ly6bKsA" : {
"bookmarkCount" : 1,
"bookmarks" : {
"jlkRoaucY6Q4GBkzhor5yAAl97I2" : true
},
"caption" : "Traumhaft",
"commentCount" : 0,
"creationDate" : 1.494082976550228E9,
"hoursSinceUpload" : 0,
"likeCount" : 2,
"likes" : {
"es5fIbnKFpX4szcCbroUqHjJg6E3" : true,
"jlkRoaucY6Q4GBkzhor5yAAl97I2" : true
},
"photoUrl" : "https://firebasestorage.googleapis.com/v0/b/funcloud-8e84e.appspot.com/o/Posts%2F306BF7E1-9FEF-493A-ABF8-C0E061E8648F?alt=media&token=128bdd90-023a-49ac-8361-19c02c631183",
"ratio" : 1.502732240437158,
"score" : 166.6491847103437,
"uid" : "jlkRoaucY6Q4GBkzhor5yAAl97I2"
}
"users" : {
"es5fIbnKFpX4szcCbroUqHjJg6E3" : {
"email" : "user3#mail.de",
"profilText" : "Schreib etwas über dich",
"profileImageUrl" : "https://firebasestorage.googleapis.com/v0/b/funcloud-8e84e.appspot.com/o/profile_image%2Fes5fIbnKFpX4szcCbroUqHjJg6E3?alt=media&token=ce8d8722-39bc-457a-8149-e51c837ef0a3",
"username" : "Blondine",
"username_lowercase" : "blondine"
}
My function where I delete data
static func removeUserData() {
let user = Auth.auth().currentUser
let uid = API.User.CURRENT_USER?.uid
Database.database().reference().child("users").child(uid!).removeValue()
Database.database().reference().child("Feed").child(uid!).removeValue()
Database.database().reference().child("Favoriten").child(uid!).removeValue()
Database.database().reference().child("LikesFromUsers").child(uid!).removeValue()
Database.database().reference().child("post-comments").child(uid!).removeValue()
Database.database().reference().child("notification").child(uid!).removeValue()
Database.database().reference().child("followers").child(uid!).removeValue()
Database.database().reference().child("following").child(uid!).removeValue()
Database.database().reference().child("LikesCommentsFromUsers").child(uid!).removeValue()
Database.database().reference().child("comments").child(uid!).removeValue()
user?.delete(completion: { (error) in
if let error = error {
print(error.localizedDescription)
} else {
print("success")
}
})
}
I would love to iterate through all posts and look for every post which contains the uid of the current user and then delete these posts.
Thanks in advance :)
I would build a server task that can run this asynchronously, removing the responsibility from the mobile device. If the app crashes or loses connection, you'll get a severely broken data set. You need to be able to run it in a stable and verifiable environment. This inherently solves your problem as well, since now you can (at your server's leisure) cycle through and delete all posts owned by the user.
As far as your app is concerned, you'll just need to call a single API after validating that the user wants to delete their account, and voila.

Create push notification when value in firebase database change

I want to send a push notification to the user when a value in my firebase database change. this is my database
{
"Battles" : {
"00000111-062B3333-4046-4FB4-AA37-C2B05853E497" : {
"BattleProgress" : "",
"Player1" : "lzsPuNwHbIZI1J8k40FspYRV4XQ2",
"Player2" : "tHNBif9csWNCOuftAGLAqvLWNUw1",
"Score" : "0-0",
"Turn" : 1
}
},
"users" : {
"lzsPuNwHbIZI1J8k40FspYRV4XQ2" : {
"Coins" : 1,
"Dollars" : 0,
"FBID" : “ID”,
"GamesLost" : 0,
"GamesWon" : 0,
"name" : “Name”
},
"tHNBif9csWNCOuftAGLAqvLWNUw1" : {
"Coins" : 0,
"Dollars" : 0,
"FBID" : “ID”,
"GamesLost" : 0,
"GamesWon" : 0,
"name" : “Name”
}
}
}
So lets say, the value of "Turn" changes, then I want a push notification sent out to the player whos turn it is. But how can I check if the value of "Turn" changes when the user shuts down the app?
I've read a bit about Firebase Cloud Messaging, but cant seem to find the answar...
You can do this with Firebase using Cloud Functions. Check out https://firebase.google.com/docs/functions/use-cases and https://firebase.google.com/docs/functions/database-events for more information.

FBLikeControl Not Posting to User's Facebook Page

I am using Facebook's iOS SDK 3.20 to add a like button to my iOS app. The problem I'm having is that after clicking the button (and then clicking on the OK button on the confirmation screen that is brought up) no post shows up on the user's Facebook page.
Now, it took me a while to get to the point where the confirmation message would come up and not some type of error message. I had to have my app reviewed by Facebook requesting the "Native Like Button" permission and then make my Facebook app public.
I have reviewed the "Getting Started" guide and the sample apps that come with the Facebook SDK several times and the only thing I'm doing different is setting the objectID of the FBLikeControl to a URL of my choosing (company web site). Here's my code:
FBLikeControl* like = [FBLikeControl alloc] init];
like.likeControlStyle = FBLikeControlStyleButton;
like.objectID = #"http://mycompany.com";
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:like];
All my testing has been done with the XCode Simulator so after clicking the like button the web browser is brought up to show the confirmation. My only guess right now is that something is not set up right on Facebook's developer web site for the app.
Also, after all the testing I've done, I no longer see the confirmation web page. The browser is just displayed briefly and the redirects me back to the app. Here's some logging from after clicking the like button if it helps:
2014-11-24 17:31:24.358 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents Persist: Writing 4 events
2014-11-24 17:31:25.933 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents Persist: Read 4 events
2014-11-24 17:31:25.933 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents Persist: Clearing
2014-11-24 17:31:25.934 4MyCabPremium[23014:90b] FBSDKLog: FBTimeSpentData Restore: {"secondsSpentInCurrentSession":93,"lastSuspendTime":1416873520,"numInterruptions":1}
2014-11-24 17:31:26.137 4MyCabPremium[23014:90b] FBSDKLog: Dynamically loaded library at /System/Library/Frameworks/AdSupport.framework/AdSupport
2014-11-24 17:31:26.137 4MyCabPremium[23014:90b] FBSDKLog: Request <#1125>:
URL: https://graph.facebook.com/v2.2/374418562723727/activities?sdk=ios&advertiser_tracking_enabled=1&bundle_id=com.testapp.liketest&format=json&application_tracking_enabled=1&bundle_version=1.13&event=CUSTOM_APP_EVENTS&url_schemes=%5B%22fb374418562723727%22%5D&advertiser_id=XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE&bundle_short_version=13
Method: POST
UserAgent: FBiOSSDK.3.20.0
MIME: multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
Body Size: 0 kB
Attachments:
sdk: ios
advertiser_tracking_enabled: 1
bundle_id: com.testapp.liketest
format: json
application_tracking_enabled: 1
bundle_version: 1.13
event: CUSTOM_APP_EVENTS
url_schemes: ["fb374418562723727"]
advertiser_id: XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE
bundle_short_version: 13
custom_events_file: <Data - 0 kB>
2014-11-24 17:31:26.138 4MyCabPremium[23014:90b] FBSDKLog: FBURLConnection <#1128>:
URL: 'https://graph.facebook.com/v2.2/374418562723727/activities?sdk=ios&advertiser_tracking_enabled=1&bundle_id=com.testapp.liketest&format=json&application_tracking_enabled=1&bundle_version=1.13&event=CUSTOM_APP_EVENTS&url_schemes=%5B%22fb374418562723727%22%5D&advertiser_id=XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE&bundle_short_version=13'
2014-11-24 17:31:26.240 4MyCabPremium[23014:90b] FBSDKLog: FBURLConnection <#1128>:
Duration: 102 msec
Response Size: 0 kB
MIME type: application/json
2014-11-24 17:31:26.240 4MyCabPremium[23014:90b] FBSDKLog: Response <#1125>
Duration: 102 msec
Size: 16 kB
Response Body:
(
{
body = {
success = 1;
};
code = 200;
}
)
2014-11-24 17:31:26.240 4MyCabPremium[23014:90b] FBSDKLog: FBAppEvents: Flushed # 1416879086, 4 events due to 'PersistedEvents' - {
"advertiser_id" = "XZF430BA2E-324F-4A4C-95E0-7FC0AD36F3FE";
"advertiser_tracking_enabled" = 1;
"application_tracking_enabled" = 1;
"bundle_id" = "com.testapp.liketest";
"bundle_short_version" = 13;
"bundle_version" = "1.13";
event = "CUSTOM_APP_EVENTS";
"url_schemes" = "[\"fb374418562723727\"]";
}
Events: [
{
"horizontal_alignment" : "left",
"_logTime" : 1416879071,
"object_id" : "http:\/\/mycompany.com",
"sound_enabled" : true,
"_implicitlyLogged" : "1",
"_ui" : "no_ui",
"style" : "button",
"auxiliary_position" : "inline",
"_eventName" : "fb_like_control_impression"
},
{
"horizontal_alignment" : "left",
"_logTime" : 1416879084,
"object_id" : "http:\/\/mycompany.com",
"sound_enabled" : true,
"_implicitlyLogged" : "1",
"_ui" : "no_ui",
"style" : "button",
"auxiliary_position" : "inline",
"_eventName" : "fb_like_control_did_tap"
},
{
"horizontal_alignment" : "left",
"_logTime" : 1416879084,
"object_id" : "http:\/\/mycompany.com",
"sound_enabled" : true,
"_implicitlyLogged" : "1",
"_ui" : "no_ui",
"style" : "button",
"auxiliary_position" : "inline",
"_eventName" : "fb_like_control_did_present_dialog"
},
{
"fb_dialog_outcome" : "Completed",
"_logTime" : 1416879084,
"_eventName" : "fb_dialogs_present_like_og",
"_implicitlyLogged" : "1",
"_ui" : "no_ui"
}
]
Flush Result : Success
Thanks in advance to anyone who can help with this problem.

Resources