我正在尝试使用Firebase创建新用户,但它正在向我发送消息"发生内部错误,打印并检查错误详细信息以获取更多信息。"我也在Firebase上启用了电子邮件密码身份验证。
这是我作为测试编写的所有代码,它仍然无法正常工作。
import UIKit
import Firebase
class ViewController: UIViewController {
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var pwordTxtField: UITextField!
@IBOutlet weak var continuebutton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func button(_ sender: Any) {
let email = emailTextField.text
let password = pwordTextField.text
Auth.auth().createUser(withEmail: email! , password: password!, completion: { (user, error) in
if let error = error {
print(error.localizedDescription)
}
else {
print("Success")
}
})
}
}
我做错了什么。
谢谢!
答案 0 :(得分:1)
在您的Podfile中包含以下pod:
pod'Firebase / Auth'
打开身份验证部分并启用电子邮件/密码登录方法并保存。 确保您已在项目中添加了GoogleService-Info.plist文件。
在Appdelegate中: -
void OnLongClick(object sender, View.LongClickEventArgs args,int position)
{
mActionMode = new MyActionMode(mActivity,this,position);
mode=mActivity.StartActionMode(mActionMode);
((View)sender).Selected = true;
return;
}
...
public class MyActionMode : Java.Lang.Object, ActionMode.ICallback
{
private Context mContext;
private PhotoAlbumAdapter mAdapter;
private int currentPosition;
public MyActionMode(Context context):this(context,null,0)
{
}
public MyActionMode(Context context, PhotoAlbumAdapter adapter,int position)
{
mContext = context;
mAdapter = adapter;
currentPosition = position;
}
public bool OnActionItemClicked(ActionMode mode, IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.itemOneId:
// do Delete
mAdapter.RemoveAt(currentPosition);
mAdapter.FinishActionMode();
return true;
case Resource.Id.itemTwoId:
// do Update
return true;
default:
return false;
}
}
public bool OnCreateActionMode(ActionMode mode, IMenu menu)
{
mode.MenuInflater.Inflate(Resource.Menu.ContextualMenu, menu);
return true;
}
public void OnDestroyActionMode(ActionMode mode)
{
mode.Dispose();
}
public bool OnPrepareActionMode(ActionMode mode, IMenu menu)
{
return false;
}
}
在Viewcontroller中: -
import Firebase
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}