Converting a CURL command for Objective C

后端 未结 3 1404
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 05:36

I\'m having a difficulty transforming this curl command for my Objective C Code:

curl -u 0ef106c78146a23becba9105d1e:X -H \"Accept: application/json\" -H \"C         


        
3条回答
  •  深忆病人
    2021-01-19 06:03

    You could just build cURL for iOS. Here is a Makefile to build an iOS lib.

    Save that file to your home folder as 'build-cURL.sh' then open Terminal and paste:

    export CURL_VERSION=7.23.0 
    sh ~/build-cURL.sh
    

    Then the script should build a static library that you can add to your project. Then you will want to add the .h files and it will be ready to go.

    I used lipo to create a fat-binary of the library so it will work in both the sim and the device, download it from here. Then add the curl folder to your project, and add the library. To do this click on your project in the upper left, click on your target, hit the "Build Phases" tab, drop down "Link Binary with Libraries", hit the plus icon and choose the .a file.

提交回复
热议问题