Switch to framework distribution
This commit is contained in:
parent
0102bdf7b7
commit
62a61ab249
58
README.md
58
README.md
|
@ -219,55 +219,15 @@ There are two ways to use this in your project: copy all the files into your pro
|
|||
|
||||
### Add the SDWebImage project to your project
|
||||
|
||||
Right-click on the project navigator and select "Add Files to "Your Project":
|
||||
|
||||
![Add Library Project](http://dl.dropbox.com/u/123346/SDWebImage/01_add_library_project.jpg)
|
||||
|
||||
In the dialog, select SDWebImage.xcodeproj:
|
||||
|
||||
![Add Library Project Dialog](http://dl.dropbox.com/u/123346/SDWebImage/02_add_library_project_dialog.jpg)
|
||||
|
||||
After you’ve added the subproject, it’ll appear below the main project in Xcode’s Navigator tree:
|
||||
|
||||
![Library Added](http://dl.dropbox.com/u/123346/SDWebImage/03_library_added.jpg)
|
||||
|
||||
You may want to add the SDWebImage directory in your project source tree as a submodule before adding it to your project.
|
||||
- Download and unzip the last version of the framework from the [download page](https://github.com/rs/SDWebImage/downloads)
|
||||
- Right-click on the project navigator and select "Add Files to "Your Project":
|
||||
- In the dialog, select SDWebImage.framework:
|
||||
- Check the "Copy items into destination group's folder (if needed)" checkbox
|
||||
|
||||
### Add build target dependencies
|
||||
|
||||
In you application project app’s target settings, find the "Build Phases" section and open the "Target Dependencies" block:
|
||||
|
||||
![Add Target Dependencies](http://dl.dropbox.com/u/123346/SDWebImage/04_add_target_dependencies.jpg)
|
||||
|
||||
Click the "+" button and select "SDWebImage ARC" (you may choose the non ARC target if you want to support iOS <3 or the ARC+MKAnnotation if you need MapKit category):
|
||||
|
||||
![Add Target Dependencies Dialog](http://dl.dropbox.com/u/123346/SDWebImage/05_add_target_dependencies_dialog.jpg)
|
||||
|
||||
Open the "Link Binary With Libraries" block:
|
||||
|
||||
![Add Library Link](http://dl.dropbox.com/u/123346/SDWebImage/06_add_library_link.jpg)
|
||||
|
||||
Click the "+" button and select "libSDWebImageARC.a" library (use non ARC version if you chose non ARC version in the previous step):
|
||||
|
||||
![Add Library Link Dialog](http://dl.dropbox.com/u/123346/SDWebImage/07_add_library_link_dialog.jpg)
|
||||
|
||||
Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
|
||||
|
||||
![Add ImageIO Framework](http://dl.dropbox.com/u/123346/SDWebImage/08_add_imageio_framework.jpg)
|
||||
|
||||
If you chose to link against the ARC+MKAnnotation target, click the "+" button again and select "MapKit.framework":
|
||||
|
||||
![Add MapKit Framework](http://dl.dropbox.com/u/123346/SDWebImage/09_add_mapkit_framework.jpg)
|
||||
|
||||
### Add headers
|
||||
|
||||
Open the "Build Settings" tab, in the "Linking" section, locate the "Other Linker Flags" setting and add the "-ObjC" flag:
|
||||
|
||||
![Other Linker Flags](http://dl.dropbox.com/u/123346/SDWebImage/10_other_linker_flags.jpg)
|
||||
|
||||
In the "Search Paths" section, locate "Header Search Paths" (and not "User Header Search Paths") and add two settings: `”$(TARGET_BUILD_DIR)/usr/local/lib/include”` and `”$(OBJROOT)/UninstalledProducts/include”`. Double click on the `<Multiple values>` to pop out the box and click on the "+" icon to add each of them. Make sure to include the quotes here:
|
||||
|
||||
![User Header Search Paths](http://dl.dropbox.com/u/123346/SDWebImage/11_user_header_search_paths.jpg)
|
||||
- In you application project app’s target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block:
|
||||
- Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
|
||||
|
||||
### Import headers in your source files
|
||||
|
||||
|
@ -282,12 +242,6 @@ In the source files where you need to use the library, import the header file:
|
|||
At this point your workspace should build without error. If you are having problem, post to the Issue and the
|
||||
community can help you solve it.
|
||||
|
||||
### Fixing indexing
|
||||
|
||||
If you have problem with auto-completion of SDWebImage methods, you may have to copy the header files in
|
||||
your project.
|
||||
|
||||
|
||||
Future Enhancements
|
||||
-------------------
|
||||
|
||||
|
|
|
@ -6,6 +6,21 @@
|
|||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
539F912B16316D2D00160719 /* SDWebImageFramework */ = {
|
||||
isa = PBXAggregateTarget;
|
||||
buildConfigurationList = 539F912C16316D2D00160719 /* Build configuration list for PBXAggregateTarget "SDWebImageFramework" */;
|
||||
buildPhases = (
|
||||
539F913116316D7A00160719 /* Build Framework */,
|
||||
);
|
||||
dependencies = (
|
||||
539F913016316D3700160719 /* PBXTargetDependency */,
|
||||
);
|
||||
name = SDWebImageFramework;
|
||||
productName = SDWebImageFramework;
|
||||
};
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
531041C4157EAFA400BBABC3 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D86148C56230056699D /* SDImageCache.m */; };
|
||||
531041C5157EAFA400BBABC3 /* SDWebImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8A148C56230056699D /* SDWebImageDecoder.m */; };
|
||||
|
@ -74,11 +89,21 @@
|
|||
53FB894914D35E9E0020B787 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53FB894814D35E9E0020B787 /* UIKit.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
539F912F16316D3700160719 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 53922D66148C55810056699D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 53761307155AD0D5005750A4;
|
||||
remoteInfo = "SDWebImage ARC";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
531041E0157EAFA400BBABC3 /* libSDWebImageARC+MKAnnotation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSDWebImageARC+MKAnnotation.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "MKAnnotationView+WebCache.h"; path = "SDWebImage/MKAnnotationView+WebCache.h"; sourceTree = SOURCE_ROOT; };
|
||||
535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "MKAnnotationView+WebCache.m"; path = "SDWebImage/MKAnnotationView+WebCache.m"; sourceTree = SOURCE_ROOT; };
|
||||
53761325155AD0D5005750A4 /* libSDWebImageARC.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDWebImageARC.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
53761325155AD0D5005750A4 /* libSDWebImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDWebImage.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
53922D6F148C55820056699D /* libSDWebImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDWebImage.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
53922D72148C55820056699D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
53922D85148C56230056699D /* SDImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDImageCache.h; path = SDWebImage/SDImageCache.h; sourceTree = SOURCE_ROOT; };
|
||||
|
@ -150,7 +175,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
53922D6F148C55820056699D /* libSDWebImage.a */,
|
||||
53761325155AD0D5005750A4 /* libSDWebImageARC.a */,
|
||||
53761325155AD0D5005750A4 /* libSDWebImage.a */,
|
||||
531041E0157EAFA400BBABC3 /* libSDWebImageARC+MKAnnotation.a */,
|
||||
);
|
||||
name = Products;
|
||||
|
@ -310,6 +335,7 @@
|
|||
53761308155AD0D5005750A4 /* Sources */,
|
||||
53761311155AD0D5005750A4 /* Frameworks */,
|
||||
53761315155AD0D5005750A4 /* Headers */,
|
||||
539F912A16316D0500160719 /* Prepare Framework */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -317,7 +343,7 @@
|
|||
);
|
||||
name = "SDWebImage ARC";
|
||||
productName = SDWebImage;
|
||||
productReference = 53761325155AD0D5005750A4 /* libSDWebImageARC.a */;
|
||||
productReference = 53761325155AD0D5005750A4 /* libSDWebImage.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
53922D6E148C55810056699D /* SDWebImage */ = {
|
||||
|
@ -361,10 +387,42 @@
|
|||
53922D6E148C55810056699D /* SDWebImage */,
|
||||
53761307155AD0D5005750A4 /* SDWebImage ARC */,
|
||||
531041C2157EAFA400BBABC3 /* SDWebImage ARC+MKAnnotation */,
|
||||
539F912B16316D2D00160719 /* SDWebImageFramework */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
539F912A16316D0500160719 /* Prepare Framework */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Prepare Framework";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers\"\n\n# Link the \"Current\" version to \"A\"\n/bin/ln -sfh A \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/Current\"\n/bin/ln -sfh Versions/Current/Headers \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Headers\"\n/bin/ln -sfh \"Versions/Current/${PRODUCT_NAME}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}\"\n\n# The -a ensures that the headers maintain the source modification date so that we don't constantly\n# cause propagating rebuilds of files that import these headers.\n/bin/cp -a \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers\"\n";
|
||||
};
|
||||
539F913116316D7A00160719 /* Build Framework */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Build Framework";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -e\nset +u\n# Avoid recursively calling this script.\nif [[ $SF_MASTER_SCRIPT_RUNNING ]]\nthen\n exit 0\nfi\nset -u\nexport SF_MASTER_SCRIPT_RUNNING=1\n\nSF_TARGET_NAME=\"SDWebImage\"\nSF_EXECUTABLE_PATH=\"lib${SF_TARGET_NAME}.a\"\nSF_WRAPPER_NAME=\"${SF_TARGET_NAME}.framework\"\n\n# The following conditionals come from\n# https://github.com/kstenerud/iOS-Universal-Framework\n\nif [[ \"$SDK_NAME\" =~ ([A-Za-z]+) ]]\nthen\n SF_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\n echo \"Could not find platform name from SDK_NAME: $SDK_NAME\"\n exit 1\nfi\n\nif [[ \"$SDK_NAME\" =~ ([0-9]+.*$) ]]\nthen\n SF_SDK_VERSION=${BASH_REMATCH[1]}\nelse\n echo \"Could not find sdk version from SDK_NAME: $SDK_NAME\"\n exit 1\nfi\n\nif [[ \"$SF_SDK_PLATFORM\" = \"iphoneos\" ]]\nthen\n SF_OTHER_PLATFORM=iphonesimulator\nelse\n SF_OTHER_PLATFORM=iphoneos\nfi\n\nif [[ \"$BUILT_PRODUCTS_DIR\" =~ (.*)$SF_SDK_PLATFORM$ ]]\nthen\n SF_OTHER_BUILT_PRODUCTS_DIR=\"${BASH_REMATCH[1]}${SF_OTHER_PLATFORM}\"\nelse\n echo \"Could not find platform name from build products directory: $BUILT_PRODUCTS_DIR\"\n exit 1\nfi\n\n# Build the other platform.\nxcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" -configuration \"${CONFIGURATION}\" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR=\"${BUILD_DIR}\" OBJROOT=\"${OBJROOT}\" BUILD_ROOT=\"${BUILD_ROOT}\" SYMROOT=\"${SYMROOT}\" $ACTION\n\n# Smash the two static libraries into one fat binary and store it in the .framework\nlipo -create \"${BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}\" \"${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}\" -output \"${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}\"\n\n# Copy the binary to the other architecture folder to have a complete framework in both.\ncp -a \"${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}\" \"${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
531041C3157EAFA400BBABC3 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
|
@ -411,12 +469,22 @@
|
|||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
539F913016316D3700160719 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 53761307155AD0D5005750A4 /* SDWebImage ARC */;
|
||||
targetProxy = 539F912F16316D3700160719 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
531041DE157EAFA400BBABC3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_OBJCPP_ARC_ABI = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DSTROOT = /tmp/SDWebImage.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
|
@ -425,6 +493,7 @@
|
|||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "SDWebImageARC+MKAnnotation";
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_STYLE = "non-global";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -433,6 +502,8 @@
|
|||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_OBJCPP_ARC_ABI = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DSTROOT = /tmp/SDWebImage.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
|
@ -441,6 +512,7 @@
|
|||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "SDWebImageARC+MKAnnotation";
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_STYLE = "non-global";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -449,14 +521,17 @@
|
|||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_OBJCPP_ARC_ABI = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DSTROOT = /tmp/SDWebImage.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = SDWebImageARC;
|
||||
PRODUCT_NAME = SDWebImage;
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_STYLE = "non-global";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -465,14 +540,17 @@
|
|||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_OBJCPP_ARC_ABI = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DSTROOT = /tmp/SDWebImage.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = SDWebImageARC;
|
||||
PRODUCT_NAME = SDWebImage;
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_STYLE = "non-global";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -543,6 +621,8 @@
|
|||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_WARN_OBJCPP_ARC_ABI = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DSTROOT = /tmp/SDWebImage.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
|
@ -550,6 +630,7 @@
|
|||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_STYLE = "non-global";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -558,6 +639,8 @@
|
|||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_WARN_OBJCPP_ARC_ABI = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DSTROOT = /tmp/SDWebImage.dst;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
|
@ -565,6 +648,21 @@
|
|||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_STYLE = "non-global";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
539F912D16316D2D00160719 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
539F912E16316D2D00160719 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -607,6 +705,14 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
539F912C16316D2D00160719 /* Build configuration list for PBXAggregateTarget "SDWebImageFramework" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
539F912D16316D2D00160719 /* Debug */,
|
||||
539F912E16316D2D00160719 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 53922D66148C55810056699D /* Project object */;
|
||||
|
|
Loading…
Reference in New Issue