在我的应用程序中,我想使用Google登录,因此我使用的是Azure服务.从Google,我能够成功登录并获取所有详细信息,但Azure端发生以下错误:
Error Domain = com.Microsoft.WindowsAzureMobileServices.ErrorDomain Code = -1302"错误:id_token发行者无效." UserInfo = {NSLocalizedDescription =错误:id_token发行者无效.}
码:
if (user.authentication != nil)
{
let delegate = UIApplication.sharedApplication().delegate as? AppDelegate
let client = delegate!.client!;
// let nextViewController = self.storyboard?.instantiateViewControllerWithIdentifier("SWRevealViewController") as! SWRevealViewController
// self.presentViewController(nextViewController, animated: true, completion: nil)
let payload: [String: String] = ["id_token": idToken]
client.loginWithProvider("google", token: payload, completion: { (user, error) in
if error != nil{
//here i am getting the above mentioned error
print(error)
}
if user != nil{
print(user)
print("Google Login Sucess") …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我想滑入和滑出视图控制器。因此,为此我正在使用自定义过渡,但应用程序崩溃了。我无法找出确切的问题所在。请帮帮我。
代码
class CustomTransition: NSObject, UIViewControllerAnimatedTransitioning,UIViewControllerTransitioningDelegate {
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
// get reference to our fromView, toView and the container view that we should perform the transition in
let container = transitionContext.containerView
let fromView = transitionContext.view(forKey: UITransitionContextViewKey.from)! // the app crashes here saying nil founded
let toView = transitionContext.view(forKey: UITransitionContextViewKey.to)!
let animationDuration = self .transitionDuration(using: transitionContext)
let offScreenRight = CGAffineTransform(translationX: container.frame.width, y: 0)
let offScreenLeft = CGAffineTransform(translationX: -container.frame.width, y: 0)
toView.transform = offScreenRight
// add the both views …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我想添加本地通知.方案是用户可以选择从周一到周日的任何时间和日期.例如,如果用户选择Mon,Thur和Sat作为日期和时间为晚上11:00,那么现在应该在所有选定的日期和特定时间通知用户.
码:
let notification = UNMutableNotificationContent()
notification.title = "Danger Will Robinson"
notification.subtitle = "Something This Way Comes"
notification.body = "I need to tell you something, but first read this."
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true)
// let test = UNCalendarNotificationTrigger()
let request = UNNotificationRequest(identifier: "notification1", content: notification, trigger: notificationTrigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码,但这不符合我的需要.
我刚刚开始开发IOS Swift,现在我被困在一件事上.我想要的是将字符串值从一个传递ViewController给另一个.
第一视图控制器
// on TableCell Click
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
CommonFunctions.setDefaults("a", value: arr[indexPath.row])
let viewController = SecondView(passedData:arr[indexPath.row])
self.presentViewController(viewController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
第二个ViewController
var test:String
init(passedData:String){
self.test = passedData
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
print(CommonFunctions.getDefaults("a"))
}
Run Code Online (Sandbox Code Playgroud)
我成功地获得了第二个字符串,ViewController但问题是我得到了黑屏.