小编Sat*_*esh的帖子

Xcode 10 - iPhone已拒绝发布请求

我正在跑步Xcode 10iOS 12.1我的iPhone 6S Plus.该应用程序在模拟器中运行时工作,但在Xcode连接我的手机运行我的应用程序时,我收到此错误:

iPhone拒绝了发布请求.

错误

我的iPhone是我的Mac上值得信赖的设备,我有签名证书.我花了几个小时用谷歌搜索解决方案,但没有一个能为我工作.

有人有主意吗?

iphone xcode ios

10
推荐指数
2
解决办法
6210
查看次数

在iphone X的安全区域设置Webview

我是新来的Xcode,我不知道如何设置webviewsafe areaiPhone X.我通过各种情侣答案已经走了,但他们并没有帮助。我对这个应用程序的唯一了解是,视图是以编程方式设置的。下面是我的ViewController.swift文件。

import UIKit
import WebKit
import AVFoundation

class ViewController: UIViewController, WKScriptMessageHandler, WKNavigationDelegate, WKUIDelegate
{
    var webView       = WKWebView()
    var containerView = WKWebView() //Footer  Webview

    override func loadView()
    {
        super.loadView()
    }

    override func viewDidLoad()
    {
        super.viewDidLoad()

        let theConfiguration = WKWebViewConfiguration()

        //Bind Swift and Javascript interface through MessageHandler IOSJSObject
        theConfiguration.userContentController.add(self, name: "IOSJSObject")

        /* Webview intialization Start */
        webView = WKWebView(frame: CGRect(x: 0, y: 20, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height-65), configuration: theConfiguration)

        containerView = …
Run Code Online (Sandbox Code Playgroud)

xcode ios swift safearealayoutguide iphone-x

6
推荐指数
1
解决办法
3990
查看次数

在iOS中解析Json响应时出现valueNotFound错误

我正在尝试使用解析响应JSONDecoder。如果相应的键有值,那么它将很好,但是如果键的值为空,则它将无法编译,并出现以下错误。

valueNotFound(Swift.String,Swift.DecodingError.Context(codingPath:[CodingKeys(stringValue:“ Results”,intValue:nil),_JSONKey(stringValue:“ Index 0”,intValue:0),CodingKeys(stringValue:“ VehicleName”, intValue:nil)],debugDescription:“期望的字符串值,但发现为null。”,底层错误:nil))

guard let obj = try? JSONDecoder().decode(ShipmentsResponse.self, from: json) else {return}
Run Code Online (Sandbox Code Playgroud)

这是我违抗的货运类

class ShipmentResponse : Codable {

    var ItemId: String = ""
    var VehicleName: String  = ""
    var VehicleNumber: String  = ""

    convenience required init(from decoder: Decoder) throws
    {
        self.init()
        let values = try decoder.container(keyedBy: CodingKeys.self)
        ItemId = try values.decode(String.self, forKey: .ItemId)

        do {
            _ = try values.decode(String.self, forKey: .VehicleName)
        } catch {
            print(error)
        }

        VehicleName = try values.decode(String.self, forKey: .VehicleName)
        VehicleNumber …
Run Code Online (Sandbox Code Playgroud)

parsing json ios swift jsondecoder

5
推荐指数
1
解决办法
433
查看次数

与导航控制器一起使用时,UITabBarItem 的标题不显示

我的非常简单的应用程序遇到了麻烦。

我的应用程序只有两个主要内容,UIViewControllers称为新闻和类别,每个都有自己的UINavigationController.

所以在AppDelegate.swift,我这样做了

window = UIWindow(frame: UIScreen.main.bounds)
let tabBarController = UITabBarController()

let newsVC = NewsVC()

// CREATE TAB BAR ITEM WITH TITLE ONLY
let newsVCTabBarItem = UITabBarItem(title: "News", image: nil, tag: 1)
newsVC.tabBarItem = newsVCTabBarItem

let categoryVC = CategoryVC()

// CREATE TAB BAR ITEM WITH TITLE ONLY
let categoryVCTabBarItem = UITabBarItem(title: "Category", image: nil, tag: 2)
categoryVC.tabBarItem = categoryVCTabBarItem

let rootViewControllers = [newsVC, categoryVC]

// CREATE NAVIGATION CONTROLLER FOR EACH OF THEM
tabBarController.viewControllers = …
Run Code Online (Sandbox Code Playgroud)

uitabbarcontroller uitabbaritem ios swift

4
推荐指数
1
解决办法
2035
查看次数

如何将事件侦听器添加到 React Native 中的状态

FlatList当状态messages改变时,我试图滚动到我的末尾。目前我this.refs.flatList.scrollToEnd();在等待一段时间后正在使用,它工作正常。我想要做的是向messages状态添加一个事件侦听器,这样当列表以任何方式更改时,它都会滚动到列表的末尾。我试过

componentDidMount(){
        this.state.messages.addEventListener('change', this._handleNewMessage);
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用。有谁知道我可以实现这一目标的方法?

javascript react-native expo

3
推荐指数
1
解决办法
1万
查看次数

反应本机navigationOptions调用函数错误

在内部调用函数时出错navigationOptions

static navigationOptions = {
    tabBarIcon: ({ tintColor })=> (
      <Icon name='ios-add-circle' style={{ color: tintColor}} />
    ),
    tabBarOnPress: () => {
      this.callingFun();
    },
  }

  callingFun = ()=> {
    console.log('tabBarOnPress:');
  }
Run Code Online (Sandbox Code Playgroud)

错误:

错误图片

react-native react-navigation

3
推荐指数
1
解决办法
1990
查看次数

发布主题同步异常警告

我在操场上玩 RxSwift 时遇到了警告。这是完整的警告消息:

Synchronization anomaly was detected.
- Debugging: To debug this issue you can set a breakpoint in RxSwift/RxSwift/Rx.swift:113 and observe the call stack.
Problem: This behavior is breaking the observable sequence grammar. `next (error | completed)?`
- This behavior breaks the grammar because there is overlapping between sequence events.
Observable sequence is trying to send an event before sending of previous event has finished.
- Interpretation: Two different unsynchronized threads are trying to send some event simultaneously.
This …
Run Code Online (Sandbox Code Playgroud)

ios swift rx-swift

3
推荐指数
1
解决办法
1837
查看次数