这是以下代码,但我在swift3中收到以下错误
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
notificationReceived(notification: userInfo as [NSObject : AnyObject])
}
func notificationReceived(notification: [NSObject:AnyObject]) {
let viewController = window?.rootViewController
let view = viewController as? ViewController
view?.addNotification(
title: getAlert(notification: notification).0,
body: getAlert(notification: notification).1)
}
private func getAlert(notification: [NSObject:AnyObject]) -> (String, String) {
let aps = notification["aps"] as? NSDictionary
let alert = aps?["alert"] as? [String:AnyObject]
let title = alert?["title"] as? String
let body = alert?["body"] as? String
return (title …Run Code Online (Sandbox Code Playgroud) 我正处于在 iOS 中使用 ReactNative 的学习阶段。所以目前我已经为它完成了所有的初始设置,现在我正在学习基本学习教程。 反应本机
但我收到以下错误。
相关的 .js 文件代码在这里
// src/ReactCalculator.js
import React, { Component } from 'react';
import {
Text,
AppRegistry
} from 'react-native';
class ReactCalculator extends Component {
render() {
return (
<Text>Hello, React!</Text>
)
}
}
AppRegistry.registerComponent(‘reactTutorialApp’, () => ReactCalculator);
Run Code Online (Sandbox Code Playgroud)
请帮我看看情况。
我试图使用swift 3在storyboard中创建一个视图控制器作为我的应用程序中的启动画面.我正在尝试使用"启动图像"加载启动时实现与启动画面相同的效果.由于我在启动画面中有动画,我希望在Swift 3中使用视图控制器作为启动画面.如何实现这一目标?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController = storyboard.instantiateViewController(withIdentifier: "splashScreen")
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
return true
}
Run Code Online (Sandbox Code Playgroud) 目前,我设计了一个用户界面,其中包含两个用于重置密码的简单文本字段。在我看来,我没有使用过UIScrollView。因此,当 UI 在 iPhone SE 上显示时,UI 应向上移动,因为UITextField隐藏在键盘后面。为了避免这种情况,我使用了一个著名的库:
https://github.com/hackiftekhar/IQKeyboardManager
但当我的用户界面出现时,它仍然没有移动。