QuickBlox TSendPush error - ios

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)

Related

MSGraphSDK user details API callback not responding back when user password changed in iOS

I tried to get the user details using MSGraph SDK in iOS using below API method. Iam successfully received the user details all the time. But when user charged their password or update their credentials, i received the oauthConnection Error: only in log. And i didn't receive any call back in the below API. Why it is not responding back when any kind of error occurred? Please help me. Thanks in advance.
[MSGraphClient setAuthenticationProvider:self.authProvider.authProvider];
self.graphClient = [MSGraphClient client];
[[[self.graphClient me]request]getWithCompletion:^(MSGraphUser *response, NSError *error) {
if(!error){
// Im able to get back here
}
else{
//Im not received any call back here when user changed their password or any error occurred.
[self.authProvider disconnect];
}
}];`
I am kinda new to MS Graph, so I might be missing something, but your graphClient declaration seems a little bit poor to me.
Try to download this sample: https://github.com/Azure-Samples/active-directory-dotnetcore-daemon-v2
And check it's declaration of graphClient.
You might be missing the part which refreshes the token?

iOS: Firebase invite through email not working

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.

How to authenticate user with token (stay authenticated in iPhone)

I have two related questions and I hope someone help me because I've been stuck for 2 days
First: mobile phone failed to authenticate
Here is what I have done:
1- user signs up
2- token released
3- token saved in user's device
but then when the same user try to do API requests I get
Rooute to sign up :
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
$api->post('auth/signup', 'App\Api\V1\Controllers\AuthController#signup');
then I get a token , so I guess everything looks great!
then now when the same device sends a post request to laravel I get this message
"message": "Failed to authenticate because of bad credentials or an invalid authorization header."
this is the route to the post request
$api->group(['middleware'=>'api.auth'],
function ($api) {
$api->post('auth/ios', 'App\Api\V1\Controllers\AuthController#create');
Second: is my method right to save data made by a mobile phone?
Since I couldn't test this method I'd like to know if this is at least one of the right ways to receive data and save it. The reason to save it is because I will show it in a control panel.
public function create(Request $request)
{
$user = new User();
$id = Auth::id();
$user->phone = $request->input('phone');
$user->city = $request->input('city');
$user->street = $request->input('street');
$user->save();
return 'Employee record successfully created with id ' . $user->id;
}
I understand that you are authenticate users based on api token.
Here is what you could do :
set up a column called api_token in users table by adding the following migration
$table->string('api_token', 60)->unique();.This generates a random api token for every user.
send the api_token back to the user's device and save it there
Send it back with every request. Preferalbly set it up globally and send it in the request Authentication request header
Get the authenticated user like so$user= Auth::guard('api')->user();
Laravel takes care of all the authentication stuff behind the scenes.
Learn More about this here

Quickblox IOS Error "Token is required" while Signing Up or Signing In User

I know there are some similiar questions regarding Quickblox returning error "Token is required" but am not able to associate in my case.
Quickblox is returning Error "Token is required" this can make sense if i am requesting after Signing in or signing up.
But why it is giving error while signing in or signing up?
Before Using QuickBlox SDK you Need to initialize Token
To create session , use below code in you app Delegate
QBASession *session = [QBASession new];
session.token = #"f23d03bd2341a1f923b7d4c1fbee97af1cd296f2";
you can update Token if required using Below code
[[QBSession currentSession] startSessionWithDetails:session updateSessionBlock:{
QBASession *updatedSession = [QBASession new];
session.token = #"new token";
[[QBSession currentSession] startSessionWithDetails:updatedSession];
}];

Paypal IOS SDK issues (can't communicate with servers)

I am trying to process a paypal payment using the latest IOS SDK 2 - BASICALLY i'm trying to follow the example at -
https://github.com/paypal/PayPal-iOS-SDK/blob/master/docs/single_payment.md
without much luck.
Background
I'm in Australia.
I'm using the paypal sdk to take a payment in IOS app. the app then makes a call to a PHP web server that will validate the paypal payment and then update a subscription on the PHP server backend.
What I've done and where I'm getting stuck.
I've setup a classic API application.
I've set the production and sandbox environments using -
[PayPalMobile initializeWithClientIdsForEnvironments:
#{PayPalEnvironmentProduction : #"HIDDEN",
PayPalEnvironmentSandbox : #"HIDDEN"}
];
With the text HIDDEN replaced with the real ones.
I used the following code, that successfully starts the paypal dialog -
[PayPalMobile preconnectWithEnvironment:PayPalEnvironmentSandbox];
PayPalPayment *payment = [[PayPalPayment alloc] init];
NSDecimalNumber *total_cost = NSDecimalNumber decimalNumberWithString:#"4.30"];
// Amount, currency, and description
payment.amount = total_cost;
payment.currencyCode = #"USD";
payment.shortDescription = #"test";
// Use the intent property to indicate that this is a "sale" payment,
// meaning combined Authorization + Capture. To perform Authorization only,
// and defer Capture to your server, use PayPalPaymentIntentAuthorize.
payment.intent = PayPalPaymentIntentSale;
// Check whether payment is processable.
if (!payment.processable) {
[self display_message: #"Payment could not be processed. This can happen for a variety of reasons, i.e. the payment amount was negative, etc. Please contact us if you believe you have received this message in error."];
return;
}
// Create a PayPalPaymentViewController.
PayPalPaymentViewController *paymentViewController;
paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
configuration:self.payPalConfiguration
delegate:self];
// Present the PayPalPaymentViewController.
[self presentViewController:paymentViewController animated:YES completion:nil];
The paypal dialog appears but then displays a "can't communicate with servers error, try again later".
the following appears on the xcode console -
2014-03-25 10:42:22.432 PayPal SDK: Request has failed with error:
pp_service_error_json_parse_error - System error. Please try again later. (500) | PayPal Debug-ID: a26da2c300c31 | Details: (
{
"ns_error" = "Error Domain=NSCocoaErrorDomain Code=3840 \"The operation couldn\U2019t be completed. (Cocoa error 3840.)\" (No value.) UserInfo=0xbadecd0 {NSDebugDescription=No value.}";
}
).
so QUESTION (1) any ideas why this is happening.
and QUESTION (2) after this works and I can make a payment, do I then need to confirm the payment info returned from paypal? i.e. do I -
Extract the payment id from the SDK callback.
Create a rest app id in paypal in addition to the classic one, and
then get an auth token via a rest call to payal. without the rest
app, i don't seem to have the secret key, etc to access the paypal
rest service.
Then use the auth token and id from (1) to make another rest call
to get the payal payment info and validate it (i.e. check the amount
is whats expected etc)?
Hope that makes sense.
PS I find the docs incredibly confusing.
EDIT: Ok, so next day without anything changed, i tried running the app again, this time different xcode console error - "invalid client credentials". nowhere in this example at https://github.com/paypal/PayPal-iOS-SDK/blob/master/docs/single_payment.md does it specify client credentials except for this part around client ids -
[PayPalMobile initializeWithClientIdsForEnvironments:
#{PayPalEnvironmentProduction : #"HIDDEN",
PayPalEnvironmentSandbox : #"HIDDEN"}
];
which i've set correctly. are their additional credentials that need to be set before launching paypal ios sdk ui?

Resources