I'm trying to publish a check-in on a users wall. I don't need to get the longitude and latitude of the users device. But rather have this static as well as the place the user will check-in too. Basically a "check-in" button that already has static coordinates and a message.
I got the demo app up and running but can't seem to find any step by step tutorials on this particular topic. Is there any link around or a sample project you can point me to?
Thanks!
First, you need to have a place id. Assuming you have that you can use the Facebook Graph API to make a feed post to check-in the user.
You can do something like this (using Facebook iOS SDK 3.0):
[FBRequestConnection startForPostStatusUpdate:#"Awesome place!"
place:#"110506962309835"
tags:nil
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
//verify result
}
];
Or:
[FBRequestConnection startWithGraphPath:#"me/feed"
parameters:#{#"place":#"110506962309835"}
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
//verify result
}];
You will need to ask the user for publish_stream permission before making this call.
Related
Good evening ppl at Microsoft!
I have an Mobile App Service at Microsoft Azure Located at South Central US named CeneamApp.
My backend is configured in a way so that my user can access only the data they capture, by making use of stable user ids.
so I had followed Adrian Hall book to create an a user id (https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter2/authorization/)with the following format sid:{identifier}as described here: (https://github.com/Azure/azure-mobile-apps-net-server/wiki/Understanding-User-Ids).
now all my userid had been changed and my user cant access their previous data capture by them, because somehow the provider or issuer or whatever is going on, doesnt let me retrieve a user id as described by the github project team wiki (in the previous link). so instead i receive a new userid but seem to be a random number:
I'm adding screenshot of the essential part of my code at my backend project which i debugged so i could understand whats going on and my dummy database where you can see an stable_id save on it and the new suppose stable_ids the next two rows.
Debugged code retrieving apparently a new userid from FACEBOOK could you confirm about this change? because I havent been able to understand this change.
Dummy Database with the lost userid and the new ones from other accounts database screenshot
if anyone has information about this odd behavior i would appreciate to enlight me, because this line of code:
principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;
used to give me a user id with this format: "sid:{identifier}", now the format is a the screenshot shows.
Same situation here. About to go live and suddenly this. Interesting that only one Mobile App based in the UK datacenter is affected. Other 2 apps which are in production and plus another Web App are still fine.
The full solution can only be provided by Azure team. But I have a workaround and and idea:
1. Workaround.
In the base controller I read and parse the token from the header. The sid is in the subject of the token. The code is simple:
string _userSid;
public string UserSid
{
get
{
if (_userSid == null)
{
KeyValuePair<string, IEnumerable<string>> auth_header = Request.Headers.FirstOrDefault(h => h.Key.Equals("x-zumo-auth", StringComparison.InvariantCultureIgnoreCase));
string token = auth_header.Value.FirstOrDefault();
if (!string.IsNullOrEmpty(token))
{
var jwtToken = new JwtSecurityToken(token);
if (jwtToken != null)
{
_userSid = jwtToken.Subject;
}
}
}
return _userSid;
}
}
I use it instead of getting this from ClaimPrinciple as per manual. I checked the Mobile App Server code does a very similar thing.
2. Idea.
Azure Mobile Apps have this parameter:
MobileAppsManagement_EXTENSION_VERSION it is recommended to set to latest. I think if we downgraded it to previous version it would work until Microsoft finds and solves the problem. The only issue is that I do not know and could not find the version number. May be someone knows and can post here?
I have to implement Facebook invite in my iOS app.
I am following below reference link:
https://developers.facebook.com/docs/app-invites/ios
and
created app link as per below link:
https://developers.facebook.com/docs/applinks
I am facing below error:-
Error Domain=com.facebook.sdk.core Code=9 "The operation couldn’t be completed. (com.facebook.sdk.core error 9.)"
in below FBSDKAppInviteDialogDelegate delegate method
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
println("didFailWithError: \(error)")
}
My plist setting is
My code is as given below:
#IBAction func btnInviteClicked(sender: UIBarButtonItem) {
var content: FBSDKAppInviteContent = FBSDKAppInviteContent()
content.appLinkURL = NSURL(string: "https://fb.me/MyFacebookAppLinkURL")
//Optional
content.appInvitePreviewImageURL = NSURL(string: "AnyImageURL")
FBSDKAppInviteDialog.showWithContent(content, delegate: self)
}
Pls suggest any solution, to show invite pop up and work successfully.
Thanks in advance.
Make sure you have [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; in your AppDelegate. I've spend two days while trying to fix that.
If you haven't created an appLinkURL as #Rumin suggested in the comments, you can create them and make sure they work here https://developers.facebook.com/quickstarts/?platform=app-links-host.
When you have your app links ready, make sure you have your app working with the latest App Transport Security restrictions made in iOS 9 and also whitelisting the other Facebook apps, follow this link https://developers.facebook.com/docs/ios/ios9.
Some context: the user had previously installed the app, authorized FB, everything worked great, then they changed their FB password (through facebook.com), deleted the app, and have now reinstalled it and are running it for the first time again after reinstall.
I am calling [FBSession openActiveSessionWithReadPermissions:allowLoginUI:completionHandler] with allowLoginUI: YES and the read permissions being "email, user_about_me, user_birthday, user_interests, user_location."
The FBSessionState I am getting in the completionHandler is FBSessionStateClosedLoginFailed. The NSLog of the error is this:
Error Domain=com.facebook.sdk Code=2 "The operation couldn’t be completed. (com.facebook.sdk error 2.)" UserInfo=0x1cd68c00 {com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:ErrorLoginFailedReason, com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=7 "The Facebook server could not fulfill this access request: Error validating access token: The session has been invalidated because the user has changed the password." UserInfo=0x1cd5b970 {NSLocalizedDescription=The Facebook server could not fulfill this access request: Error validating access token: The session has been invalidated because the user has changed the password.}}
That internal error domain is ACErrorDomain and error code ACErrorPermissionDenied. So, how do I let the user re-authorize the app?
I have tried calling openActiveSessionWithReadPermissions again but that just keeps outputting the same error. I have also tried [FBSession.activeSession closeAndClearTokenInformation] but that doesn't seem to do anything (presumably because there is no activeSession).
Hitting a very similar sort of bug with 3.2.1 Facebook SDK. In my case, I get into FBSessionStateOpen but have been given an invalid access token. As the question states, the normal closeAndClearTokenInformation and even deleting the app doesn't fix it. The only way I have been able to get-back-in under this scenario is to have the user change their password in the setting app. So this is what I do.
// In my completion handler FBSessionStateOpen is called BUT an
// invalid accessToken was detected.
[session closeAndClearTokenInformation];
[FBSession renewSystemCredentials:^(ACAccountCredentialRenewResult result,
NSError *error)
{
if (result == ACAccountCredentialRenewResultFailed ||
result == ACAccountCredentialRenewResultRejected)
{
[self showErrorMessage:NSLocalizedString(#"You may need to re-enter your Facebook password in the iPhone Settings App.\n", nil)];
}
else
{
// attempt opening a session again (after they have updated their account
// settings I end up here)
[self facebookLogin]; // Performs openActiveSessionWithReadPermissions,
// but this time around the token issued should be good.
}
}];
This is the only pragmatic solution I have been able to come up with.
I think you need to get a new access token with code like this...
[FBSession.activeSession closeAndClearTokenInformation];
[[FBSession class] performSelector:#selector(renewSystemAuthorization)];
[FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
}
I have some problems with my Push Notifications. I can sent them well to my registered Devices. All works fine.
My Questions is: After clicking the VIEW button, the App is launching. At the moment without any content.
How can i add content here? This content should depend on the Push Notification i sent out.
For example: My Push Notification is about NEWS XYZ - then after clicking VIEW i should get more informations about NEWS XYZ
So i think i must get the news from my website. Perhabs with the ID they are posted on my side.
But how to implement this in the App?
I mean with every NEW Push Message, the must be shown the NEW News.
Also it should be possible to read all previous received NEWS in the App in a list, when getting back from NEWS Number 1.
You understand, what i mean?
I dont have any real idea...Would be nice if you can show me code regarding to an example.
Thanks.
This method invokes once you tap on the view button on the push notification,
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
if (application.applicationState == UIApplicationStateInactive) {
// Application came from the background
// Here you can request for the content
// This has the value of your payload
UILocalNotification *localNotif = (UILocalNotification *) [userInfo objectForKey:#"aps"];
}
else if (application.applicationState == UIApplicationStateActive) {
// Application is in the foreground
}
}
Anyone know if it's now feasible to launch the 'Settings' app from your app? Google Maps does it when you don't have Location Services enabled and you try to locate yourself.
I've seen lots of folks post about it and most answers point to adding a bug in Radar.
In the wild, I know of two apps that show this dialog with ""Turn on Location Services to Allow [app] to Determine Your Location" along side Cancel and Settings buttons where the 'Settings' button will take you to the General Settings.
1) Facebook app version 3.3.2 that runs on iOS 3.1.3 shows this alert on start. I looked at the three20 source code in git-hub but that project is not really a full source of the app but more of a library with the app's components.
2) GroupMe also shows the same alert when adding current location to a new message.
You mean the settings of the app like you see in settings?
First create a settings.bundle in xcode>newfile>settings.bundle.
This will create some prop lists that you can edit from out of the Settings.app or your app self. For the exact code Google can help you a lot further that I can. If you have any specific questions; don't hesitate to ask.
In iOS 5.0 you can open settings using the "prefs://" URL scheme. But in iOS 5.1 it doesn't work. But there is a trick I used for login twitter account using settings inside my app. the code is
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
// Create the completion handler block.
[tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result)
{
[self dismissModalViewControllerAnimated:YES];
}];
// Present the tweet composition view controller modally.
[self presentModalViewController:tweetViewController animated:YES];
tweetViewController.view.hidden = YES;
for (UIView *view in tweetViewController.view.subviews){
[view removeFromSuperview];
}
Using this code you can switch to settings from your app directly if you are not already logged in twitter account.