Sinch Callout Verification : not verifying on input "1" - ios

I am trying to use Sinch Callout Verification for my iOS App. I have implemented the code according to documentation. And I do receive call on iPhone. Recorded voice tells me to "Please press 1 for verification or hang up if you didn't requested this call"
When I enter "1" from my iPhone keyboard, nothing happens. Computer just keep repeating above message.
But when I hang up I do get a call back in my code with failure.
Below is my code :
NSString* defaultRegion = info.countryAbbr.uppercaseString; //this is my country in upper case and its correct
NSError *parseError = nil;
id<SINPhoneNumber> phoneNumber = [SINPhoneNumberUtil() parse:[info getFullPhoneNo]
defaultRegion:defaultRegion
error:&parseError];
if (!phoneNumber){
// Handle invalid user input
}
NSString *phoneNumberInE164 = [SINPhoneNumberUtil() formatNumber:phoneNumber
format:SINPhoneNumberFormatE164];
id<SINVerification> verification = [SINVerification calloutVerificationWithApplicationKey:#"4ecb3c90-6d92-40c5-9a96-649f84fcc93e"
phoneNumber:phoneNumberInE164];
[verification initiateWithCompletionHandler:^(id<SINInitiationResult> result, NSError *error) {
[SPProgressHud hideAllHUDsForView:self.view animated:YES];
if (result.success) {
// when I enter/press "1" call should hang up and code here should run
} else {
if ([error.domain isEqualToString:SINVerificationErrorDomain] &&
error.code == SINVerificationErrorCancelled) {
// Handle cancellation error code separately
NSLog(#"Verification cancelled: %#", error);
} else {
// Inform user of error, e.g. that input was invalid.
}
}
}];
iOS Version : 11.2.6
Xcode Version : 9.2
Sinch Verification Version : 2.0.6 installed using cocoapods
Language : Objective - C
Country : Pakistan (PK)
Service Provider : Zong (CMPak)

Related

Unable to localize Face Id popup for non-matching face

It seems like Face Id is ignoring localizedFallbackTitle and localizedReason. However localizedCancelTitle is working fine. Does anyone know how to get it work?
My code:
LAContext *context = [[LAContext alloc] init];
if ([context respondsToSelector:#selector(setLocalizedCancelTitle:)]) {
context.localizedCancelTitle = [Language get:CANCEL alter:nil];
}
if ([context respondsToSelector:#selector(setLocalizedFallbackTitle:)])
{
context.localizedFallbackTitle = [Language get:TRY_AGAIN alter:nil];
}
NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:&error]) {
[context evaluatePolicy:LAPolicyDeviceOwnerAuthentication
localizedReason:[Language get:AUTHRNTICATE_USING_YOUR_FACE alter:nil] reply:^(BOOL success, NSError *error) {
//code
}
Screenshot:
I want to localize everything on this popup if possible.
Note: Attached screenshot is taken on simulator. I have also checked
it on real device but the result is same. Also, for Touch id it is working properly.
According to this Post, there is no API for changing the Reason in between the auth process.
localizedReason
The app-provided reason for requesting authentication, which displays in > the authentication dialog presented to the user.
You can use BiometricAuthentication to show your message.
BioMetricAuthenticator.authenticateWithBioMetrics(reason: "", success: {
// authentication successful
}, failure: { [weak self] (error) in
// do nothing on canceled
if error == .canceledByUser || error == .canceledBySystem {
return
}
// device does not support biometric (face id or touch id) authentication
else if error == .biometryNotAvailable {
self?.showErrorAlert(message: error.message())
}
// show alternatives on fallback button clicked
else if error == .fallback {
// here we're entering username and password
self?.txtUsername.becomeFirstResponder()
}
// No biometry enrolled in this device, ask user to register fingerprint or face
else if error == .biometryNotEnrolled {
self?.showGotoSettingsAlert(message: error.message())
}
// Biometry is locked out now, because there were too many failed attempts.
// Need to enter device passcode to unlock.
else if error == .biometryLockedout {
// show passcode authentication
}
// show error on authentication failed
else {
self?.showErrorAlert(message: error.message())
}
})

moodstocks sdk : You already opened scanner with different pair , API key / Secret pair issue

While some days before everything working fine but right now i didn't made any changes in my code still i am getting this error while opening path for scanning.
Console Log is here:
-(void) initializeMoodStock {
NSString *path = [MSScanner cachesPathFor:#"scanner.db"];
_scanner = [[MSScanner alloc] init];
[_scanner openWithPath:path key:MS_API_KEY secret:MS_API_SECRET error:nil];
// Create the progression and completion blocks:
void (^completionBlock)(MSSync *, NSError *) = ^(MSSync *op, NSError *error) {
// if (error)
// NSLog(#"Sync failed with error: %#", [error ms_message]);
// else
// NSLog(#"Sync succeeded (%li images(s))", (long)[_scanner count:nil]);
};
void (^progressionBlock)(NSInteger) = ^(NSInteger percent) {
// NSLog(#"Sync progressing: %li%%", (long)percent);
};
// Launch the synchronization
[_scanner syncInBackgroundWithBlock:completionBlock progressBlock:progressionBlock];
}
& initializeMoodStock called from didFinishLaunchingWithOptions:
Three cases here,
Sometime you need to reset content and settings of your simulator.
& if not works that mean,
Might be someone has deleted your project from moodstocks developer account
Or sometime admin reseted your project API KEY & Moodstocks secret key.
Now check 2nd & 3rd case go to developer account check your keys & update it in your appDelegate.

How do I test Apple's new Search Ads Attribution API?

Here is the code I'm using. How can I test attributionDetails from Apple so I can ensure my Search Ads Attribution API code is working properly? Apple provides little to no details (https://searchads.apple.com/help/measure-results/#attribution-api) on how developers can do some test dummy conversions for testing.
+ (void)conversionTracking
{
if ([[ADClient sharedClient] respondsToSelector:#selector(requestAttributionDetailsWithBlock:)])
{
// iOS 10 call exists
[[ADClient sharedClient] requestAttributionDetailsWithBlock:^(NSDictionary *attributionDetails, NSError *error) {
if (error) {
NSLog(#"Request Search Ads attributes failed with error: %#", error.description);
if (error.code == ADClientErrorLimitAdTracking) {
NSLog(#"Limit Ad Tracking is enabled for this device.");
}
}
else {
NSLog(#"Search Ads attributes: %#", attributionDetails);
// Found details, track the purchase.
NSString *searchAdsCampaign = #"";
// Check value for "iad-attribution":
if ([attributionDetails valueForKey:#"iad-attribution"] != nil) {
// Check value:
if ([[attributionDetails valueForKey:#"iad-attribution"] boolValue]) {
// Get campaign name:
if ([attributionDetails valueForKey:#"iad-campaign-name"] != nil) {
NSString *campaignName = [attributionDetails valueForKey:#"iad-campaign-name"];
// Exclude Apple test data, where value is "CampaignName":
if ([campaignName isEqualToString:#"CampaignName"]) {
searchAdsCampaign = #"No Campaign";
}
else {
searchAdsCampaign = campaignName;
}
}
else {
// Key not found:
searchAdsCampaign = #"Error";
}
}
else {
// Value "false":
searchAdsCampaign = #"No Campaign";
}
}
else {
// Key not found:
searchAdsCampaign = #"Error";
}
// TRACK IT HERE. Pass up searchAdsCampaign for tracking to my server.
}
}];
}
}
There are 2 ways to test it:
Unit test: try OCMock to test it and return the dummy data that Apple documents in their documents
Test on devices (iOS 9 and above): run your code on the devices. You should be able to receive the dummy data from Apple. I could see the dummy data on development and test flight versions.
Note that you may need to use older APIs for iOS 8 and iOS 7 :
- determineAppInstallationAttributionWithCompletionHandler:
- lookupAdConversionDetails:
if your app supports older versions of iOS by checking whether the ADClient responds to the methods above. Also, attributionDetails contains a smaller dictionary with the key "Version3.1" so your code is not correct (as documented in the official documentation):
{ “Version3.1” =
{
“iad-attribution” = true;
“iad-org-name” = “Light Right”;
“iad-campaign-id” = 15292426;
“iad-campaign-name” = “Light Bright Launch”;
“iad-conversion-date” = “2016-06-14T17:18:07Z”;
“iad-click-date” = “2016-06-14T17:17:00Z”;
“iad-adgroup-id” = 15307675;
“iad-adgroup-name” = “LightRight Launch Group”;
“iad-keyword” = “light right”;
};
}
You will need to get the innerDictionary first before looking up the iad-attribution value.
Do some testing on a device and I think you'll find that this line:
if ([[attributionDetails valueForKey:#"iad-attribution"] boolValue]
... should actually be:
if ([[attributionDetails valueForKey:#"iad-attribution"] isEqualToString:#"true"]
I realize this does not really answer the question of how to test it. But perhaps you are not aware that if you just run your code on a real device, you will get some dummy data as a response.

mailcore2 imap Error Domain=MCOErrorDomain Code=5

I in turn to the making relevant mailcore2 problems, based on past errors, and all of the share, or didn't find the solution to this problem below, so the problem I have encountered redistribution, also hope to get more help, thank you!
Mailcore2 using the code below:
self.imapSession = [[MCOIMAPSession alloc] init];
self.imapSession.hostname = hostname;
self.imapSession.port = 993;
self.imapSession.username = username;
self.imapSession.password = password;
if (oauth2Token != nil) {
self.imapSession.OAuth2Token = oauth2Token;
self.imapSession.authType = MCOAuthTypeXOAuth2;
}
self.imapSession.connectionType = MCOConnectionTypeTLS;
MasterViewController * __weak weakSelf = self;
self.imapSession.connectionLogger = ^(void * connectionID, MCOConnectionLogType type, NSData * data) {
#synchronized(weakSelf) {
if (type != MCOConnectionLogTypeSentPrivate) {
NSLog(#"event logged:%p %i withData: %#", connectionID, type, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
}
}
};
// Reset the inbox
self.messages = nil;
self.totalNumberOfInboxMessages = -1;
self.isLoading = NO;
self.messagePreviews = [NSMutableDictionary dictionary];
[self.tableView reloadData];
NSLog(#"checking account");
self.imapCheckOp = [self.imapSession checkAccountOperation];
[self.imapCheckOp start:^(NSError *error) {
MasterViewController *strongSelf = weakSelf;
NSLog(#"finished checking account.");
if (error == nil) {
[strongSelf loadLastNMessages:NUMBER_OF_MESSAGES_TO_LOAD];
} else {
NSLog(#"error loading account: %#", error);
}
strongSelf.imapCheckOp = nil;
}];
When I use iOS8.1 equipment, error message as follows, the console output:
checking account
2015-02-15 10:58:36.712 MailCoreTest[11971:2988194] event logged:0x166a4d50 0 withData: * OK [CAPABILITY IMAP4 IMAP4rev1 IDLE XAPPLEPUSHSERVICE ID UIDPLUS AUTH=LOGIN NAMESPACE] QQMail IMAP4Server ready
2015-02-15 10:58:36.821 MailCoreTest[11971:2988194] event logged:0x166a4d50 0 withData: (null)
2015-02-15 10:58:36.824 MailCoreTest[11971:2988128] finished checking account.
2015-02-15 10:58:36.825 MailCoreTest[11971:2988128] error loading account: Error Domain=MCOErrorDomain Code=5 "Unable to authenticate with the current session's credentials." UserInfo=0x16596ec0 {NSLocalizedDescription=Unable to authenticate with the current session's credentials.}
But when I use iOS8.0 devices, console to print the results are as follows:
checking account
2015-02-15 11:22:53.249 MailCoreTest[7853:1742121] finished checking account.
2015-02-15 11:22:53.249 MailCoreTest[7853:1742121] error loading account: Error Domain=MCOErrorDomain Code=1 "A stable connection to the server could not be established." UserInfo=0x17e50ab0 {NSLocalizedDescription=A stable connection to the server could not be established.}
Please help me, I contact with Objective - C time is short, but I must do my best to be aggressive, still hope to give a detailed solution, sincere thank you once again, hard work!
Yes its an authentication issue, I had same issue with my app but it was working fine before.
After I got this error, I checked my gmail account and there was an email from Google with subject "Suspicious Sign in prevented" and This sign in was of CA, USA. Actually My Application was under review so it was rejected for this reason.
Then I found that gmail is disabling unauthorised IPs.
You have to enable the 2 step verification for the gmail account to resolve this and generate an app specific password. Use that password in your app and It'll work fine.
Follow below google link to generate application specific password.
https://support.google.com/mail/answer/1173270?hl=en

Fetching Current User Profile using Objective C Google Plus Client Library

I am using the Google CLient Libraries for Objective C available here..
I have successfully been able to Authorize the user and get refresh token. (Using the GTMOAuthenticaion api embedded within).
In the Selector called after successful authorization I make the Get User Profile request as follows.. (I need the id of currently loggedin/authenticated user)
-(void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
if (error != nil) {
NSLog(#"Stop");
} else {
if ([auth canAuthorize]){
[Mediator plusService].authorizer = auth;
// Problematic Line
GTLQueryPlus *profileQuery = [GTLQueryPlus queryForPeopleGetWithUserId:#"me"]; // Notice the UserId Param
profileQuery.completionBlock = ^(GTLServiceTicket *ticket, id object, NSError *error) {
if (error == nil) {
self.mediator.gProfile = object;
} else {
NSLog(#"GPlus Service Error %#", error);
}
};
[[Mediator plusService] executeQuery:profileQuery completionHandler:
^(GTLServiceTicket *ticket, id result, NSError *error) {
if (error)
NSLog(#"Some Service Error %#", error);
}];
}
}
}
If I put "me" as parameter, I get invalid user ID error string in jSON response.
However, If I provide some userId like my own 113632923069489732066 it works perfectly fine and returns the appropriate jSON response..!!
The Example for Google Plus inside Examples folder also fails to get current user profile ending with following error.
Error Domain=com.google.GTLJSONRPCErrorDomain Code=400 "The operation couldn’t be completed. (Invalid user ID: {0})" UserInfo=0x7a670fa0 {NSLocalizedFailureReason=(Invalid user ID: {0}), GTLStructuredError=GTLErrorObject 0x7a67b130: {message:"Invalid user ID: {0}" code:400 data:[2]}, error=Invalid user ID: {0}}
P.S. My API Console application doesn't work with iOS option under installed app but needs be configured with "Other" option. When configured with iOS option, the oAuth fails with invalid_client error response.
My Mistake .. !! And a very silly one .. !!
I was signing in using a Gmail Account that was yet not associated with GPlus .. !! =/

Resources