我的应用已登录,Facebook登录和braintree集成。
我在appdelegate.swift中添加了以下代码:
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
let checkFB = FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
let checkGoogle = GIDSignIn.sharedInstance().handle(url as URL!,sourceApplication: sourceApplication,annotation: annotation)
return checkGoogle || checkFB
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
if url.scheme?.localizedCaseInsensitiveCompare("com.release.braintreepayments") == .orderedSame {
return BTAppSwitch.handleOpen(url, options: options)
}
return false
}
当我放置func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {}
时,我的签到停止工作,如果我发表评论,登录工作正常。你能告诉我如何将两者结合起来吗?我确信选择其中一种方法存在一些冲突,但我需要两种方法。
我也联系了Braintree支持。
答案 0 :(得分:1)
尝试仅使用第二个:
public partial class MyUserControl : UserControl
{
public static readonly DependencyProperty TargetPropertyNameProperty = DependencyProperty.Register(
"TargetPropertyName",
typeof(string),
typeof(MyUserControl),
new UIPropertyMetadata(TargetPropertyNamePropertyChangedHandler)
);
public static void TargetPropertyNamePropertyChangedHandler(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
var MyUserControl = sender as MyUserControl;
MyUserControl.TargetPropertyName = (string)e.NewValue;
}
public string TargetPropertyName
{
get
{
return (string)GetValue(TargetPropertyNameProperty);
}
set
{
SetValue(TargetPropertyNameProperty, value);
BindTextPropertyToTargetPropertyNameOnce()
}
}
public MyUserControl()
{
InitializeComponent();
}
private bool _firstRun = true;
private void BindTextPropertyToTargetPropertyNameOnce()
{
if (_firstRun)
{
_firstRun = false;
var binding = new Binding(TargetPropertyName)
{
Mode = BindingMode.TwoWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
ValidatesOnDataErrors = true,
NotifyOnValidationError = true
};
MainTextBox.SetBinding(TextBox.TextProperty, binding);
}
}
}