I'm Using BTDropInController for payment. On 3 Method of payment (Paypal, Venmo, By Card) from Access Control Panel. and Create TokenizationKey also generate.
Now in my Code Firstly import
#import <BraintreeDropIn/BraintreeDropIn.h>
#import <Braintree/BraintreeCore.h>
#import <Braintree/BraintreePayPal.h>
After implement Code dropIn showing but then i click on credit or debit card open another controller to get my card detail But then i click on paypal or venmo nothing happen just show "ERROR" in Debug area
BTDropInController *dropIn = [[BTDropInController alloc] initWithAuthorization:clientTokenOrTokenizationKey request:request handler:^(BTDropInController * _Nonnull controller, BTDropInResult * _Nullable result, NSError * _Nullable error) {
if (error != nil) {
NSLog(#"ERROR");
} else if (result.cancelled) {
NSLog(#"CANCELLED");
[self dismissViewControllerAnimated:YES completion:^{
//
}];
} else {
// Use the BTDropInResult properties to update your UI
// result.paymentOptionType
// result.paymentMethod
// result.paymentIcon
// result.paymentDescription
[self dismissViewControllerAnimated:YES completion:^{
//
}];
}
}];
[self presentViewController:dropIn animated:YES completion:nil];
Related
I have this code
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:#[self.imageView.image] applicationActivities:nil];
__weak typeof(self) weakSelf = self;
UIActivityViewControllerCompletionWithItemsHandler completionHandlerBlock = ^void(NSString * __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError) {
if (activityType == UIActivityTypeSaveToCameraRoll && completed) {
[EkoAlertService presentAlertOnViewController:weakSelf
withTitle:NSLocalizedString(#"save_photo_dialog_title", nil)
message:NSLocalizedString(#"save_photo_dialog_message", nil)
completion:nil];
}
};
[activityViewController setCompletionWithItemsHandler:completionHandlerBlock];
[self presentViewController:activityViewController animated:YES completion:nil];
It works fine in the case when user click allow permission to Save Image, but when they click don't allow permission I expect it to return some error but activityError is nil and I have no way to check whether you successfully save image to camera roll. Both cases return completed = YES
Is there a way to check this?
Thanks
I am following the following tutorial
https://developers.braintreepayments.com/guides/drop-in/ios/v4
In this I am finding issues when I post the payment nuance to server. The drop in UI remains after I enter the card details. And the options are still enabled so while the payment nuance is in progress user can select another option
Here is my code
BTDropInRequest *request = [[BTDropInRequest alloc] init];
BTDropInController *dropIn = [[BTDropInController alloc] initWithAuthorization:client_TOK request:request handler:^(BTDropInController * _Nonnull controller, BTDropInResult * _Nullable result, NSError * _Nullable error) {
if (error != nil) {
NSLog(#"ERROR");
} else if (result.cancelled) {
NSLog(#"CANCELLED");
[self dismissViewControllerAnimated:YES completion:NULL];
} else {
[self performSelector:#selector(dismiss_BT)
withObject:nil
afterDelay:0.0];
[self postNonceToServer:result.paymentMethod.nonce];
}
}];
[self presentViewController:dropIn animated:YES completion:nil];
In this above image I want to hide the Braintree drop in after I enter the card detail / Paypal
Thanks in advance
I want to present RPBroadcastActivityViewController, but fail. The sample code just present a black view.
- (IBAction)displayServiceViewController:(id)sender {
RPBroadcastActivityViewController *rpBroadcastActivityViewController = [[RPBroadcastActivityViewController alloc] init];
[self presentViewController:rpBroadcastActivityViewController animated:YES completion:nil];
}
I hope it's the following effect:
expected
- (IBAction)displayServiceViewController:(id)sender {
[RPBroadcastActivityViewController loadBroadcastActivityViewControllerWithHandler:^(RPBroadcastActivityViewController * _Nullable broadcastActivityViewController, NSError * _Nullable error) {
broadcastActivityViewController.delegate = self;
[self presentViewController:broadcastActivityViewController animated:YES completion:nil];
}];
}
I'm simply trying to implement the iTunes store screen in my application, and it displays correctly. However, when the user is finished with the screen (makes a purchase or clicks 'cancel') all I get is a white screen, and I have to completely close my app and reopen it.
It turns out my productViewControllerDidFinish method isn't being called.
I have a table view controller that has the SKStoreProductViewControllerDelegate and I'm presenting and dismissing the store view in the same class, so why isn't the delegate method being called?
- (void)toStore:(Button*)sender {
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
[storeProductViewController loadProductWithParameters:#{SKStoreProductParameterITunesItemIdentifier : #"stuff"} completionBlock:^(BOOL result, NSError *error) {
if (error) {
NSLog(#"Error %# with User Info %#.", error, [error userInfo]);
} else {
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
- (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
Both in a UITableViewController. Thanks in advance!
Set delegate of SKStoreProductViewController controller.. You missed to do that..
Set it just below object allocation..
storeProductViewController.delegate = self;
I played around a bit with TouchID and I have the following question:
After successful TouchID login, how do I present a new ViewController?
The code in the viewController.m is:
#import "ViewController.h"
#import LocalAuthentication;
#import "SVProgressHUD.h"
#interface ViewController ()
#end
#implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
LAContext *context = [[LAContext alloc] init];
NSError *error;
// check if the policy can be evaluated
if (![context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error])
{
NSLog(#"error:%#", error);
NSString *msg = [NSString stringWithFormat:#"Can't evaluate policy! %#", error.localizedDescription];
[SVProgressHUD showErrorWithStatus:msg];
return;
}
// evaluate
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:#"Please login through TouchID"
reply:
^(BOOL success, NSError *authenticationError) {
dispatch_async(dispatch_get_main_queue(), ^{
if (success) {
[SVProgressHUD showSuccessWithStatus:#"Everything Worked!"];
//Code for new viewController should come here!
}
else {
NSLog(#"error:%#", authenticationError);
[SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:#"FAILED! %#", authenticationError.localizedDescription]];
}
});
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
viewController.h is standart. Nothing changed in it.
Thanks for support :)
To present a view controller we normally use following methods
If we are using storyboard,then call following method
[self performSegueWithIdentifier:#"indentifierForViewController" sender:self];
If we are not using storyboard then we can use
NextTaskViewControler *add = [[NextTaskViewControler alloc]
initWithNibName:#"NextTaskViewController" bundle:nil];
[self presentViewController:nextTaskVC animated:YES completion:nil];
I suggest you to use UINavigationController, a specialized view controller that manages other view controllers to provide a hierarchical navigation for the user. Present a viewcontroller only for specific purpose such as presenting a photo with few actions in it.It's easy to maintain when view hierarchy becomes complex
Please go-through UINavigationController Refrence