小编Ria*_*ian的帖子

为什么 SwiftUI UIHostingController 有额外的间距?

我正在尝试使用 UIHostingController 将 SwiftUI 视图添加到 UIKit 视图,并且它显示额外的间距(此示例是为了模拟生产应用程序上的问题而制作的)。这是屏幕截图。

在此输入图像描述

布局概览:

View
  UIStackView
    UIImageView
    UIView(red)
    UIHostingController
    UIView(blue)
Run Code Online (Sandbox Code Playgroud)

问题: 快速 UI 视图 (UIHostingController) 显示在红色和蓝色视图之间,它在分隔线之后显示额外的间距。间距根据 SwiftUI 视图的大小而变化。

如果我减少行数(Hello World 文本)或减少间距,它似乎工作正常。

这是完整的源代码(https://www.sendspace.com/file/ux0xt7):

ViewController.swift(主视图)

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var mainStackView: UIStackView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        addView()
    }


    private func addView() {
        mainStackView.spacing = 0
        mainStackView.alignment = .fill
        
        let imageView = UIImageView()
        imageView.image = UIImage(named: "mountain")
        imageView.contentMode = .scaleAspectFill
        imageView.clipsToBounds = true …
Run Code Online (Sandbox Code Playgroud)

autolayout swift swiftui uihostingcontroller ios15

19
推荐指数
3
解决办法
6566
查看次数

将视频上传到Facebook错误:视频上传超时

我尝试使用Graph API将视频上传到Facebook,但出现此错误。

code = 390;
error_subcode = 1363030;
error_user_msg = "Your video upload timed out before it could be completed. This is probably because of a slow network connection or because the video you're trying to upload is too large. Please try again.";
 error_user_title = "Video Upload Time Out";
 message = "There was a problem uploading your video file. Please try again.";
Run Code Online (Sandbox Code Playgroud)

下面是我的代码:

NSData *videoData = [NSData dataWithContentsOfFile:videoURL];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                videoData, @"video.mp4",
                                @"video/mp4", @"contentType",
                                @"message text", @"title", …
Run Code Online (Sandbox Code Playgroud)

facebook facebook-graph-api ios

5
推荐指数
0
解决办法
621
查看次数

如何在Vapor 3中进行第三方api调用?

我想在Vapor 3中使用一些参数进行后期调用。

POST: http://www.example.com/example/post/request

title: How to make api call
year: 2019
Run Code Online (Sandbox Code Playgroud)

可以使用哪个包装/功能?

api swift vapor

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

[FIRA_AppDelegate- messaging:didRefreshRegistrationToken:]:无法识别的选择器发送到实例 - firebase崩溃问题

当我重新安装iOS应用程序时,我发现了一个新问题.在重新安装应用程序之前工作正常.在重新安装之前,我更新了cocoa sdk repo,并将Firebase和FirebaseDatabase版本从3.15.0更新到4.0.0版.

这是以下崩溃日志:

- [FIRA_AppDelegate-1495465837867 messaging:didRefreshRegistrationToken:]:无法识别的选择器发送到实例0x174661b40 2017-05-22 23:10:58.550969 + 0800 moodfriends [1716:245390]***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因: ' - [FIRA_AppDelegate-1495465837867 messaging:didRefreshRegistrationToken:]:无法识别的选择器发送到实例0x174661b40'

objective-c ios firebase firebase-realtime-database

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