小编Use*_*511的帖子

升级反应原生版本

将我的 React Native 版本从 0.63.3 升级到最新版本后,出现以下错误:

> Could not resolve all files for configuration ':classpath'.
   > Could not find com.facebook.react:react-native-gradle-plugin:.
     Required by:
         project :
Run Code Online (Sandbox Code Playgroud)

以下是我的 build.gradle 文件中的依赖项:

   dependencies {
        classpath("com.android.tools.build:gradle:7.0.4")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:4.1.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
Run Code Online (Sandbox Code Playgroud)

有人能给我解释一下吗?如果您能提供帮助,我们将不胜感激!

android upgrade android-studio react-native

7
推荐指数
1
解决办法
8733
查看次数

如何将数据从视图控制器传递到选项卡栏控制器的第一个选项卡

我想将图像和新闻从视图控制器传递到连接的选项卡栏控制器的第一个选项卡。NewsViewController 的第一个选项卡不显示新闻标题和图像。didSelectRowAt indexPath 方法如下。

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
    let storybaord=UIStoryboard(name: "Main", bundle: nil)
    let tabBar=storybaord.instantiateViewController(withIdentifier: "tabBar") as! UITabBarController
    let DVC = tabBar.viewControllers?[0] as! NewsViewController
    tabBar.selectedIndex = 0
    DVC.getImage=sneakersnews[indexPath.row].image
    DVC.getNews=sneakersnews[indexPath.row].news
    self.navigationController?.pushViewController(tabBar, animated: true)
}
Run Code Online (Sandbox Code Playgroud)

如何从表视图中传递并显示第一个选项卡 NewsViewController 上的新闻和图像?

您可以从此链接下载该项目:

https://drive.google.com/file/d/1qfI3UaXoUTzOS6Jfe40wj99NAifVkz5Y/view?usp=sharing **

uitabbarcontroller uitableview ios swift

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

如何将图像上传为二进制

我想以二进制形式上传图像,就像我们在下面在 Postman 中所做的那样

在此输入图像描述

这是我的代码

var url = myURLString
url = url.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!

guard let imageData = UIImageJPEGRepresentation(image, 0.4) else {
        return
    }

request.httpBody = imageData
request.httpMethod = "POST"
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")

Alamofire.request(request).responseJSON { (response) in
        if let JSON = response.result.value as? NSDictionary {
            print(JSON)
        } else {
            let message = response.result.error != nil ? response.result.error!.localizedDescription : "Unable to communicate."
            print(message)
        }
 }
Run Code Online (Sandbox Code Playgroud)

看来请求没有附加图像文件,返回以下错误消息

“响应无法序列化,输入数据为零或长度为零。”

ios postman swift alamofire

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