【问题标题】:Getting LibCurl to work on iOs...让 LibCurl 在 iOs 上工作...
【发布时间】:2012-07-31 11:33:13
【问题描述】:

有没有人有让 LibCurl 在 iPhone OS 上工作的经验?任何教程或示例代码可用于了解与 iOS 开发的 cURL 相关的所有内容。

【问题讨论】:

标签: iphone objective-c xcode curl libcurl


【解决方案1】:

您可以在以下位置找到示例应用程序和静态库: http://seiryu.home.comcast.net/~seiryu/libcurl-ios.html

我无法构建一个有效的 xcode 项目来编译我自己的框架,所以我编写了一个 bash 脚本

CurlVersion="7.29.0"
export IPHONEOS_DEPLOYMENT_TARGET="4.3"
otherBuildFlags="--with-darwinssl"

rm -rf results 
rm -rf Products/libcurl.framework/Versions/$CurlVersion
mkdir -p results/iOS
mkdir -p results/Sim

make clean
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2"
export CFLAGS="-arch armv7 -arch armv7s -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk"
export LDFLAGS="-arch armv7 -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk"
./configure --disable-shared --enable-static --disable-dependency-tracking --host="armv7-apple-darwin" --host="armv7s-apple-darwin" $otherBuildFlags
make -j `sysctl -n hw.logicalcpu_max`
cp lib/.libs/* results/iOS/

make clean
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2"
export CFLAGS="-arch i386 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk"
export CPPFLAGS="-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IPHONEOS_DEPLOYMENT_TARGET%%.*}0000"
export LDFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk"
./configure --disable-shared --enable-static --host="i386-apple-darwin" $otherBuildFlags
make -j `sysctl -n hw.logicalcpu_max`
cp lib/.libs/* results/Sim/

lipo -create results/iOS/libcurl.a results/Sim/libcurl.a -output results/libcurl.a

mkdir -p Products/libcurl.framework/Versions/$CurlVersion/Headers
mkdir -p Products/libcurl.framework/Versions/$CurlVersion/Resources

cp include/curl/*.h Products/libcurl.framework/Versions/$CurlVersion/Headers/
cp results/libcurl.a Products/libcurl.framework/Versions/$CurlVersion/

cd Products/libcurl.framework/Versions/
ln -fs $CurlVersion Current

cd ..

ln -fs Versions/Current/libcurl.a libcurl 

ln -fs Versions/Current/Headers .
ln -fs Versions/Current/Resources .

【讨论】:

    猜你喜欢
    • 2011-12-30
    • 2013-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-31
    • 1970-01-01
    • 2012-02-20
    • 2013-02-06
    相关资源
    最近更新 更多