简体   繁体   中英

Alamofire multipart upload post error in Swift

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

( http://www.awesomescreenshot.com/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 => 'https://github.com/Alamofire/Alamofire.git', :branch => 'master'

end
target 'ProjectNameTests' do
end

after updating your pod file you need to run this command to update the cocoapods project

pod install --verbose

There could be an installation issue with Alamofire. Check that you have imported it properly.

Changing .POST for Alamofire.Method.POST or Method.POST (if you're also targeting iOS 7 and you didn't import Alamofire as dynamic framework) will reveal the real issue or fix your problem.

Check out this thread . Also don't forget that again, when supporting iOS 7, you do not call Alamofire methods with the Alamofire. keyword.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM