当我尝试使用Alamofire上传图片时,我收到错误.POST
我附上一张图片以显示错误
(
如果您不使用 cocoapods 只需打开 Alamofire 文件夹,转到源文件夹和mak确定你也有相同的文件
如果你没有找到 MultipartFormData.swift 这意味着你的Alamofire版本不支持MultipartFormData,那么您需要从 Alamofire 获取最新版本,或者如果您使用 cocoapods 您必须更新 Alamofire pod 的行在 podfile 就像这样
platform:ios,'8.0' use_frameworks! 目标'ProjectName'做 pod'Alamofire',:git => 'github/Alamofire/Alamofire.git',: branch => 'master' end target'ProjectNameTests'do end更新你的pod文件后你需要运行这个命令来更新cocoapods项目
pod install --verbose
When i tried to upload image using Alamofire I'm getting error in .POST
Im attaching an image along with this to show the error
(www.awesomescreenshot/image/422237/0d5fe4a4b486b14fdf52f8ca26d22bea)
解决方案I had the same problem , as Michal said it's an installation issue if you are using cocoapods go to your project files/pods/Alamofires/Source and make sure you have 9 files there just like this image and make sure that the MultipartFormData.swift file is there
if you are not using cocoapods just open the Alamofire folder and go to source folder and make sure you have the same files there too
if you didn't find MultipartFormData.swift that means that your Alamofire version does not support MultipartFormData then you will need to get the latest version from here Alamofire or if you use cocoapods you will have to update the line of Alamofire pod on podfile to be like this
platform :ios, '8.0' use_frameworks! target 'ProjectName' do pod 'Alamofire', :git => 'github/Alamofire/Alamofire.git', :branch => 'master' end target 'ProjectNameTests' do endafter updating your pod file you need to run this command to update the cocoapods project
pod install --verbose
更多推荐
Swift中的Alamofire分段上传帖子错误
发布评论