2012-07-31 41 views
0

有沒有人有LibCurl在iPhone OS上工作的經驗?任何教程或示例代碼可用於理解與iOS開發的cURL相關的所有事情。讓LibCurl在iOs上工作...

+0

以下鏈接可能有所幫助:http://creativealgorithms.com/blog/content/building-libcurl-ios-42 – trojanfoe 2012-07-31 11:37:15

回答

1

你可以找到一個示例應用程序和靜態libaries: 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 . 
相關問題