iOS: Firebase invite through email not working - ios

I am trying to send the invitation through emails using Firebase. When i select the user and tap on send, i got an alert view saying invitation has been sent successfully. But i am not getting the email to the invitee.
Here is my code for sending the invite.
// Invite friends
id<FIRInviteBuilder> inviteDialog = [FIRInvites inviteDialog];
[inviteDialog setInviteDelegate:self];
FIRInvitesTargetApplication *targetApplication = [[FIRInvitesTargetApplication alloc] init];
targetApplication.androidClientID = #"Android ID";
[inviteDialog setOtherPlatformsTargetApplication:targetApplication];
NSString *message =
[NSString stringWithFormat:#"Try this out!\n -%#",
#"Ankur"];
[inviteDialog setMessage:message];
[inviteDialog setTitle:#"Invites Friends"];
[inviteDialog setDeepLink:#"Deep_Link"];
[inviteDialog setCallToActionText:#"Install!"];
[inviteDialog open];
At the same time, i am getting the invitation if i send it through phone number.
Any help would be appreciated. Thanks!

You need to add your team ID in the firebase console, it is also required that you add an App Store id (it's ok to fake one for testing)

I was having this issue because i have not mentioned the app store id in firebase console. After saving the AppStore ID, the issue got resolved.

Related

Google app invite SMS not getting sent but email working fine

i have implemented Google App Invite in iOS. Code :
self.inviteDialog = [GINInvite inviteDialog];
[self.inviteDialog setInviteDelegate: self];
NSString* message = [NSString stringWithFormat:#"Message",
[[GIDSignIn sharedInstance] currentUser].profile.name];
[self.inviteDialog setMessage: message];
[self.inviteDialog setTitle: #"App"];
[self.inviteDialog open];
I am able to send the email but SMS are not getting sent.
When i enter a phone number "MFMessageComposeViewController" opens with text :
"Message Link" but then SMS is not getting sent.
Please help
SMS messages are not sent when the message text contains some "more special" characters.
Try to use less number of symbols.
Try to reduce Message length.

Use post request to receive LinkedIn user profile information in iOS

I am looking for a way to retrieve the profile information of a LinkedIn user by making a post request, I have read these two LinkedIn pages but it doesn't seem to explain much, or I couldn't understand much of it:
REST API LinkedIn
basic profile informations
I have seen these example on stackoverflow but I didn't understood to much:
http://api.linkedin.com/v1/people/~:(id,first-name,last-name,maiden-name,email-address,formatted-name,phonetic-last-name,location:(country:(code)),industry,distance,current-status,current-share,network,skills,phone-numbers,date-of-birth,main-address,positions:(title),educations:(school-name,field-of-study,start-date,end-date,degree,activities))
I am only interested to retrieve the skills section the one that on the website appears as so:
There's a fantastic library for LinkedIn-iOS integration by Kirsten Jones, you can use that to make calls to the LinkedIn API. You need an access token to make calls.
https://github.com/PrincessPolymath/LinkedIn-OAuth-Sample-Client
Make calls like this:
NSURL *url = [NSURL URLWithString:#"http://api.linkedin.com/v1/people/~:(id,first-name,last-name,maiden-name,formatted-name,phonetic-last-name,location:(country:(code)),industry,distance,current-status,current-share,network,skills,phone-numbers,date-of-birth,main-address,positions:(title),educations:(school-name,field-of-study,start-date,end-date,degree,activities))"]];
OAMutableURLRequest *request =
[[OAMutableURLRequest alloc] initWithURL:url
consumer:oAuthLoginView.consumer
token:oAuthLoginView.accessToken
callback:nil
signatureProvider:nil];
[request setValue:#"json" forHTTPHeaderField:#"x-li-format"];
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:#selector(profileApiCallResult:didFinish:)
didFailSelector:#selector(profileApiCallResult:didFail:)];
- (void)profileApiCallResult:(OAServiceTicket *)ticket didFinish:(NSData *)data
{
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSDictionary *profile = [responseBody objectFromJSONString];
if ( profile )
{
name.text = [[NSString alloc] initWithFormat:#"%# %#",
[profile objectForKey:#"firstName"], [profile objectForKey:#"lastName"]];
headline.text = [profile objectForKey:#"headline"];
.....and get skills and other user details
}
}
Use tool:https://apigee.com/console/linkedin
API to get the list of Skills:
https://api.linkedin.com/v1/people/~:(id,num-connections,skills)?format=json
I tried it in the Console tool and able to fetch the skills for my profile. I think the individual skill ID with above request should help you to get further information. Try it out.
If anyone is reading this answer, the LinkedIn API has limited access as of May 2015. You will need to apply to their Apply with LinkedIn program to access full profile fields including skills.
https://developer.linkedin.com/docs/fields
I have fair amount of experience working with the linkedIn API. It's been a little while, but hopefully this will set you on the right track.
To get profile information from a linked in user who is one of your connections you need a format like follows:
NSString *theRequest = [NSString stringWithFormat:#"https://api.linkedin.com/v1/people/id=abc123:(first-name,last-name,picture-url,location:(name))?oauth2_access_token=%#&format=json", accessToken];
This request will return the first name, last name, profile picture url, and location of the user with the id specified.
You can see a list of field types you can request by checking out linkedIn's documentation on their profile field descriptions here:
https://developer.linkedin.com/docs/fields
If you're wondering how to get the id of the user whose profile information you want request in the first place, you can make request for some basic info (including ids) of all your connections like this:
NSString *basicConnectionInfo = [NSString stringWithFormat:#"https://api.linkedin.com/v1/people/~/connections:(id,first-name,last-name)?oauth2_access_token=%#&format=json", accessToken];
This request will give you the id, first name, and last name of all of your connections. After you've gotten the id of the person you want, you can make a request using the user's id (as shown in the first example).
Now for the slightly unfortunately news... If you followed the link provided above, you'll notice that the skills field is part of the "Member profile fields available to Apply with LinkedIn developers". I'm assuming you'll have to follow this link they provided: https://developer.linkedin.com/docs/apply-with-linkedin in order to access the skills member profile field.
I have not applied with LinkedIn. So, I haven't tested a call to the skills field. But, I'm guessing it'll be similar to the examples I've shown you. Hope this helps!

Cant get FBGraphUser email

I use Facebook login with my app. (Facebook iOS SDK version 3.11.1)
I ask for "email" permission:
NSArray *permissions = [NSArray arrayWithObjects: #"basic_info", #"email", nil];
Most of the time, I do get the user's email like that:
NSString *email = [user objectForKey:#"email"];
//user is (NSDictionary<FBGraphUser> *)
Sometimes I just don't. (I can see that the NSDictionary is not including email).
I am using this fix so the app won't terminate when i use email later and its nil:
NSString *email = [user objectForKey:#"email"] ? [user objectForKey:#"email"] : #"NO_EMAIL";
But i need the real mail, so i have to come up with a new solution.
I haven't noticed something special with the problematic users.
Any ideas what can be the problem?
It appears that its a well known problem... For many reasons, not everyone on Facebook have Email address registered.
But as i said, my problem is that i need a real mail.
So the simplest solution is to use the user's Facebook Email : user_name#facebook.com
NSString *email = [user objectForKey:#"email"] ? [user objectForKey:#"email"] : [NSString stringWithFormat:#"%##facebook.com", user.username];
some links ref to that you can't sent HTML emails to the Facebook mail, only plain text!
Here is how i have done it and it always works great for me in every situation:
(I suppose that you have added email permission in your code)
Step 1
Open Facebook Framework folder in Xcode and find the FBGraphUser.h class
As you see, you have there all the properties that you use from Facebook Framework, to take the user details, so add an other property there (copy and paste the code below):
Step 2
#property (retain, nonatomic) id<FBGraphUser> email;
And you are good to go!
You could check for a couple of things:
Make sure you are requesting email scope permission in the login request dialog:
https://www.facebook.com/dialog/oauth?client_id=APP&redirect_uri=REDIRECT&state=UNIQUE&scope=email
Check if the access token you got actually has email permission granted with the Access Token Debugger.
All facebook accounts which are verified through Phone Number instead of email will get NULL for [user objectForKey:#"email"]
Facebook won't return the email address if it's not verified.
https://developers.facebook.com/docs/graph-api/reference/v2.2/user
This person's primary email address listed on their profile. This field will not be returned if no valid email address is available.

QuickBlox TSendPush error

My ios app is running into a problem using the QuickBlox sdk's TSendPush. -(void)completedWithResult:(Result*)result gets called but result.success is false.
The debug info from the call is:
parameters:{
"event[environment]" = development;
"event[event_type]" = "one_shot";
"event[message]" = "payload=eyJhcHMiOnsic291bmQiOiJkZWZhdWx0IiwiYWxlcnQiOiJIZWxsbyBtYW4hIn19";
"event[notification_type]" = push;
"event[push_type]" = apns;
"event[user][ids]" = 673543;
}
raw body:event[environment]=development&event[event_type]=one_shot&event[message]=payload%3DeyJhcHMiOnsic291bmQiOiJkZWZhdWx0IiwiYWxlcnQiOiJIZWxsbyBtYW4hIn19&event[notification_type]=push&event[push_type]=apns&event[user][ids]=673543
and I get "Forbidden. Need user." 673543 is a valid user (well, a user of that ID is listed in the QuickBlox admin panel)
Any ideas gratefully received
It means that you have to login and do on user behalf in order to send push notifications
just do
[QBUsers logInWithUserLogin:#"igorigor" password:#"igorigor" delegate:self];
or
[QBUsers logInWithUserEmail:#"qbuserqqqq34r5#gmail.com" password:#"qbuserr345" delegate:self];
After this you can use TSendPush method
Solved. The sending user wasn't logged in correctly (I had been using their Facebook username but for some reason Facebook wasn't sending it to me)

ios-Facebook SDK 3.0 Error 5 When Posting Status Update

I am trying out adding facebook integration in an app using the new (beta) facebook ios sdk 3.0. All I would like to is post a status update to facebook. I used a FBLoginView to login to facebook. I put my app id in the plist as instructed on facebook. I put in some code to post to facebook.
(void)viewDidLoad
{
[super viewDidLoad];
NSArray *perms;
perms = [NSArray arrayWithObjects:#"status_update", nil];
FBLoginView *loginview =
[[FBLoginView alloc] initWithPermissions:perms];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;
[self.view addSubview:loginview];
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)poststatus:(UIButton *)sender {
NSString *message = [NSString stringWithFormat:#"Test staus update"];
[FBRequestConnection startForPostStatusUpdate:message
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
[self showAlert:message result:result error:error];
}];
}
- (void)showAlert:(NSString *)message
result:(id)result
error:(NSError *)error {
NSString *alertMsg;
NSString *alertTitle;
if (error) {
alertMsg = error.localizedDescription;
alertTitle = #"Error";
} else {
NSDictionary *resultDict = (NSDictionary *)result;
alertMsg = [NSString stringWithFormat:#"Successfully posted '%#'.\nPost ID: %#",
message, [resultDict valueForKey:#"id"]];
alertTitle = #"Success";
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle
message:alertMsg
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alertView show];
}
The odd thing is, this code works ONCE. After authenticating the user for the first time, I can post ONE status update successfully. After that, all subsequent attempts will fail with a FBiOSSDK error 5 (in the console, Error: HTTP status code:400). The only way to fix this is to remove the app from the facebook account and re-authenticate. I'm not sure what the problem is. I looked online for solutions but couldn't find anything. If anyone knows how to fix this, please let me know. Thanks
com.facebook.sdk error 5 is always irritating while working with Facebook iOS sdk. Most of the times it comes with addional in console Error: HTTP status code:400. Its a perception that there is a bug in Facebook iOS sdk that produces this error randomly. I think this error occurs for some certain reasons and sdk do not provide actual reason of error when it occurs.
Several Possible Reasons
Every request in sdk is accomplished with completion blocks that we actually pass as argument in completionHandler. This error occurs when a block is in progress and made another request. A simple example might be If you have written request to post on Facebook (startForPostStatusUpdate::) on some button action. On single button tap it would work fine but if you double tap on button it will throw this error com.facebook.sdk error 5
If you are trying to post when your current session is not opened. e.g. Once sign in with Facebook then kill the app then reopen and then try to share on Facebook, Result -> com.facebook.sdk error 5. In this case try to reopen session using
Facebook do not allow same status to be posted repeatedly, they think it might be some kind of spam e.g. If you are trying to update status and you have hard coded a string lets say #”This is a test status update” you are posing again and again. After 5 to 10 attempts they wont allow you to do anymore. Resulting com.facebook.sdk error 5. If this is the scenario you should change your status string and try updating.
Facebook has defined a limit for a particular user to post status using sdk. e.g If you are trying to update status and you have done lets say 15 to 20 status updates. They wont let you do more Resulting -> com.facebook.sdk error 5. In this scenario try to unauthorize the app from your Facebook account and reauthorize it OR try using other Facebook account
It seems there might be no answer to the issue. I have checked FB samples coming with SDK, in these examples also the same error happens. So it means after few status updates (15-20) Facebook reaches limits for that particular user. If you log-out for that user and log-in as another user, you can successfully post.
If I will find any extension to limit settings I will reply.
Also Facebook doesn't allow for the same Post.
Use a proxy !
FB ios SDK is just a wrap to an HTTP request to graph.facebook.com/....?access_token=.....
So you can easily replicate the request or use an HTTP proxy to see the real server answer (which is not error 5 !).

Resources