Skip to content

Commit 62a61ab

Browse files
author
Olivier Poitrey
committed
Switch to framework distribution
1 parent 0102bdf commit 62a61ab

File tree

2 files changed

+117
-57
lines changed

2 files changed

+117
-57
lines changed

README.md

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -219,55 +219,15 @@ There are two ways to use this in your project: copy all the files into your pro
219219

220220
### Add the SDWebImage project to your project
221221

222-
Right-click on the project navigator and select "Add Files to "Your Project":
223-
224-
![Add Library Project](http://dl.dropbox.com/u/123346/SDWebImage/01_add_library_project.jpg)
225-
226-
In the dialog, select SDWebImage.xcodeproj:
227-
228-
![Add Library Project Dialog](http://dl.dropbox.com/u/123346/SDWebImage/02_add_library_project_dialog.jpg)
229-
230-
After you’ve added the subproject, it’ll appear below the main project in Xcode’s Navigator tree:
231-
232-
![Library Added](http://dl.dropbox.com/u/123346/SDWebImage/03_library_added.jpg)
233-
234-
You may want to add the SDWebImage directory in your project source tree as a submodule before adding it to your project.
222+
- Download and unzip the last version of the framework from the [download page](https://github.com/rs/SDWebImage/downloads)
223+
- Right-click on the project navigator and select "Add Files to "Your Project":
224+
- In the dialog, select SDWebImage.framework:
225+
- Check the "Copy items into destination group's folder (if needed)" checkbox
235226

236227
### Add build target dependencies
237228

238-
In you application project app’s target settings, find the "Build Phases" section and open the "Target Dependencies" block:
239-
240-
![Add Target Dependencies](http://dl.dropbox.com/u/123346/SDWebImage/04_add_target_dependencies.jpg)
241-
242-
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):
243-
244-
![Add Target Dependencies Dialog](http://dl.dropbox.com/u/123346/SDWebImage/05_add_target_dependencies_dialog.jpg)
245-
246-
Open the "Link Binary With Libraries" block:
247-
248-
![Add Library Link](http://dl.dropbox.com/u/123346/SDWebImage/06_add_library_link.jpg)
249-
250-
Click the "+" button and select "libSDWebImageARC.a" library (use non ARC version if you chose non ARC version in the previous step):
251-
252-
![Add Library Link Dialog](http://dl.dropbox.com/u/123346/SDWebImage/07_add_library_link_dialog.jpg)
253-
254-
Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
255-
256-
![Add ImageIO Framework](http://dl.dropbox.com/u/123346/SDWebImage/08_add_imageio_framework.jpg)
257-
258-
If you chose to link against the ARC+MKAnnotation target, click the "+" button again and select "MapKit.framework":
259-
260-
![Add MapKit Framework](http://dl.dropbox.com/u/123346/SDWebImage/09_add_mapkit_framework.jpg)
261-
262-
### Add headers
263-
264-
Open the "Build Settings" tab, in the "Linking" section, locate the "Other Linker Flags" setting and add the "-ObjC" flag:
265-
266-
![Other Linker Flags](http://dl.dropbox.com/u/123346/SDWebImage/10_other_linker_flags.jpg)
267-
268-
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:
269-
270-
![User Header Search Paths](http://dl.dropbox.com/u/123346/SDWebImage/11_user_header_search_paths.jpg)
229+
- In you application project app’s target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block:
230+
- Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
271231

272232
### Import headers in your source files
273233

@@ -282,12 +242,6 @@ In the source files where you need to use the library, import the header file:
282242
At this point your workspace should build without error. If you are having problem, post to the Issue and the
283243
community can help you solve it.
284244

285-
### Fixing indexing
286-
287-
If you have problem with auto-completion of SDWebImage methods, you may have to copy the header files in
288-
your project.
289-
290-
291245
Future Enhancements
292246
-------------------
293247

SDWebImage.xcodeproj/project.pbxproj

Lines changed: 111 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66
objectVersion = 46;
77
objects = {
88

9+
/* Begin PBXAggregateTarget section */
10+
539F912B16316D2D00160719 /* SDWebImageFramework */ = {
11+
isa = PBXAggregateTarget;
12+
buildConfigurationList = 539F912C16316D2D00160719 /* Build configuration list for PBXAggregateTarget "SDWebImageFramework" */;
13+
buildPhases = (
14+
539F913116316D7A00160719 /* Build Framework */,
15+
);
16+
dependencies = (
17+
539F913016316D3700160719 /* PBXTargetDependency */,
18+
);
19+
name = SDWebImageFramework;
20+
productName = SDWebImageFramework;
21+
};
22+
/* End PBXAggregateTarget section */
23+
924
/* Begin PBXBuildFile section */
1025
531041C4157EAFA400BBABC3 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D86148C56230056699D /* SDImageCache.m */; };
1126
531041C5157EAFA400BBABC3 /* SDWebImageDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 53922D8A148C56230056699D /* SDWebImageDecoder.m */; };
@@ -74,11 +89,21 @@
7489
53FB894914D35E9E0020B787 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53FB894814D35E9E0020B787 /* UIKit.framework */; };
7590
/* End PBXBuildFile section */
7691

92+
/* Begin PBXContainerItemProxy section */
93+
539F912F16316D3700160719 /* PBXContainerItemProxy */ = {
94+
isa = PBXContainerItemProxy;
95+
containerPortal = 53922D66148C55810056699D /* Project object */;
96+
proxyType = 1;
97+
remoteGlobalIDString = 53761307155AD0D5005750A4;
98+
remoteInfo = "SDWebImage ARC";
99+
};
100+
/* End PBXContainerItemProxy section */
101+
77102
/* Begin PBXFileReference section */
78103
531041E0157EAFA400BBABC3 /* libSDWebImageARC+MKAnnotation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSDWebImageARC+MKAnnotation.a"; sourceTree = BUILT_PRODUCTS_DIR; };
79104
535699B415113E7300A4C397 /* MKAnnotationView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "MKAnnotationView+WebCache.h"; path = "SDWebImage/MKAnnotationView+WebCache.h"; sourceTree = SOURCE_ROOT; };
80105
535699B515113E7300A4C397 /* MKAnnotationView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "MKAnnotationView+WebCache.m"; path = "SDWebImage/MKAnnotationView+WebCache.m"; sourceTree = SOURCE_ROOT; };
81-
53761325155AD0D5005750A4 /* libSDWebImageARC.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDWebImageARC.a; sourceTree = BUILT_PRODUCTS_DIR; };
106+
53761325155AD0D5005750A4 /* libSDWebImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDWebImage.a; sourceTree = BUILT_PRODUCTS_DIR; };
82107
53922D6F148C55820056699D /* libSDWebImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDWebImage.a; sourceTree = BUILT_PRODUCTS_DIR; };
83108
53922D72148C55820056699D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
84109
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 @@
150175
isa = PBXGroup;
151176
children = (
152177
53922D6F148C55820056699D /* libSDWebImage.a */,
153-
53761325155AD0D5005750A4 /* libSDWebImageARC.a */,
178+
53761325155AD0D5005750A4 /* libSDWebImage.a */,
154179
531041E0157EAFA400BBABC3 /* libSDWebImageARC+MKAnnotation.a */,
155180
);
156181
name = Products;
@@ -310,14 +335,15 @@
310335
53761308155AD0D5005750A4 /* Sources */,
311336
53761311155AD0D5005750A4 /* Frameworks */,
312337
53761315155AD0D5005750A4 /* Headers */,
338+
539F912A16316D0500160719 /* Prepare Framework */,
313339
);
314340
buildRules = (
315341
);
316342
dependencies = (
317343
);
318344
name = "SDWebImage ARC";
319345
productName = SDWebImage;
320-
productReference = 53761325155AD0D5005750A4 /* libSDWebImageARC.a */;
346+
productReference = 53761325155AD0D5005750A4 /* libSDWebImage.a */;
321347
productType = "com.apple.product-type.library.static";
322348
};
323349
53922D6E148C55810056699D /* SDWebImage */ = {
@@ -361,10 +387,42 @@
361387
53922D6E148C55810056699D /* SDWebImage */,
362388
53761307155AD0D5005750A4 /* SDWebImage ARC */,
363389
531041C2157EAFA400BBABC3 /* SDWebImage ARC+MKAnnotation */,
390+
539F912B16316D2D00160719 /* SDWebImageFramework */,
364391
);
365392
};
366393
/* End PBXProject section */
367394

395+
/* Begin PBXShellScriptBuildPhase section */
396+
539F912A16316D0500160719 /* Prepare Framework */ = {
397+
isa = PBXShellScriptBuildPhase;
398+
buildActionMask = 2147483647;
399+
files = (
400+
);
401+
inputPaths = (
402+
);
403+
name = "Prepare Framework";
404+
outputPaths = (
405+
);
406+
runOnlyForDeploymentPostprocessing = 0;
407+
shellPath = /bin/sh;
408+
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";
409+
};
410+
539F913116316D7A00160719 /* Build Framework */ = {
411+
isa = PBXShellScriptBuildPhase;
412+
buildActionMask = 2147483647;
413+
files = (
414+
);
415+
inputPaths = (
416+
);
417+
name = "Build Framework";
418+
outputPaths = (
419+
);
420+
runOnlyForDeploymentPostprocessing = 0;
421+
shellPath = /bin/sh;
422+
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";
423+
};
424+
/* End PBXShellScriptBuildPhase section */
425+
368426
/* Begin PBXSourcesBuildPhase section */
369427
531041C3157EAFA400BBABC3 /* Sources */ = {
370428
isa = PBXSourcesBuildPhase;
@@ -411,12 +469,22 @@
411469
};
412470
/* End PBXSourcesBuildPhase section */
413471

472+
/* Begin PBXTargetDependency section */
473+
539F913016316D3700160719 /* PBXTargetDependency */ = {
474+
isa = PBXTargetDependency;
475+
target = 53761307155AD0D5005750A4 /* SDWebImage ARC */;
476+
targetProxy = 539F912F16316D3700160719 /* PBXContainerItemProxy */;
477+
};
478+
/* End PBXTargetDependency section */
479+
414480
/* Begin XCBuildConfiguration section */
415481
531041DE157EAFA400BBABC3 /* Debug */ = {
416482
isa = XCBuildConfiguration;
417483
buildSettings = {
418484
CLANG_ENABLE_OBJC_ARC = YES;
419485
CLANG_WARN_OBJCPP_ARC_ABI = YES;
486+
COPY_PHASE_STRIP = NO;
487+
DEAD_CODE_STRIPPING = NO;
420488
DSTROOT = /tmp/SDWebImage.dst;
421489
GCC_PRECOMPILE_PREFIX_HEADER = YES;
422490
GCC_PREFIX_HEADER = "";
@@ -425,6 +493,7 @@
425493
OTHER_LDFLAGS = "-ObjC";
426494
PRODUCT_NAME = "SDWebImageARC+MKAnnotation";
427495
SKIP_INSTALL = YES;
496+
STRIP_STYLE = "non-global";
428497
};
429498
name = Debug;
430499
};
@@ -433,6 +502,8 @@
433502
buildSettings = {
434503
CLANG_ENABLE_OBJC_ARC = YES;
435504
CLANG_WARN_OBJCPP_ARC_ABI = YES;
505+
COPY_PHASE_STRIP = NO;
506+
DEAD_CODE_STRIPPING = NO;
436507
DSTROOT = /tmp/SDWebImage.dst;
437508
GCC_PRECOMPILE_PREFIX_HEADER = YES;
438509
GCC_PREFIX_HEADER = "";
@@ -441,6 +512,7 @@
441512
OTHER_LDFLAGS = "-ObjC";
442513
PRODUCT_NAME = "SDWebImageARC+MKAnnotation";
443514
SKIP_INSTALL = YES;
515+
STRIP_STYLE = "non-global";
444516
};
445517
name = Release;
446518
};
@@ -449,14 +521,17 @@
449521
buildSettings = {
450522
CLANG_ENABLE_OBJC_ARC = YES;
451523
CLANG_WARN_OBJCPP_ARC_ABI = YES;
524+
COPY_PHASE_STRIP = NO;
525+
DEAD_CODE_STRIPPING = NO;
452526
DSTROOT = /tmp/SDWebImage.dst;
453527
GCC_PRECOMPILE_PREFIX_HEADER = YES;
454528
GCC_PREFIX_HEADER = "";
455529
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
456530
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
457531
OTHER_LDFLAGS = "-ObjC";
458-
PRODUCT_NAME = SDWebImageARC;
532+
PRODUCT_NAME = SDWebImage;
459533
SKIP_INSTALL = YES;
534+
STRIP_STYLE = "non-global";
460535
};
461536
name = Debug;
462537
};
@@ -465,14 +540,17 @@
465540
buildSettings = {
466541
CLANG_ENABLE_OBJC_ARC = YES;
467542
CLANG_WARN_OBJCPP_ARC_ABI = YES;
543+
COPY_PHASE_STRIP = NO;
544+
DEAD_CODE_STRIPPING = NO;
468545
DSTROOT = /tmp/SDWebImage.dst;
469546
GCC_PRECOMPILE_PREFIX_HEADER = YES;
470547
GCC_PREFIX_HEADER = "";
471548
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
472549
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
473550
OTHER_LDFLAGS = "-ObjC";
474-
PRODUCT_NAME = SDWebImageARC;
551+
PRODUCT_NAME = SDWebImage;
475552
SKIP_INSTALL = YES;
553+
STRIP_STYLE = "non-global";
476554
};
477555
name = Release;
478556
};
@@ -543,13 +621,16 @@
543621
buildSettings = {
544622
CLANG_ENABLE_OBJC_ARC = NO;
545623
CLANG_WARN_OBJCPP_ARC_ABI = NO;
624+
COPY_PHASE_STRIP = NO;
625+
DEAD_CODE_STRIPPING = NO;
546626
DSTROOT = /tmp/SDWebImage.dst;
547627
GCC_PRECOMPILE_PREFIX_HEADER = YES;
548628
GCC_PREFIX_HEADER = "";
549629
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
550630
OTHER_LDFLAGS = "-ObjC";
551631
PRODUCT_NAME = "$(TARGET_NAME)";
552632
SKIP_INSTALL = YES;
633+
STRIP_STYLE = "non-global";
553634
};
554635
name = Debug;
555636
};
@@ -558,13 +639,30 @@
558639
buildSettings = {
559640
CLANG_ENABLE_OBJC_ARC = NO;
560641
CLANG_WARN_OBJCPP_ARC_ABI = NO;
642+
COPY_PHASE_STRIP = NO;
643+
DEAD_CODE_STRIPPING = NO;
561644
DSTROOT = /tmp/SDWebImage.dst;
562645
GCC_PRECOMPILE_PREFIX_HEADER = YES;
563646
GCC_PREFIX_HEADER = "";
564647
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
565648
OTHER_LDFLAGS = "-ObjC";
566649
PRODUCT_NAME = "$(TARGET_NAME)";
567650
SKIP_INSTALL = YES;
651+
STRIP_STYLE = "non-global";
652+
};
653+
name = Release;
654+
};
655+
539F912D16316D2D00160719 /* Debug */ = {
656+
isa = XCBuildConfiguration;
657+
buildSettings = {
658+
PRODUCT_NAME = "$(TARGET_NAME)";
659+
};
660+
name = Debug;
661+
};
662+
539F912E16316D2D00160719 /* Release */ = {
663+
isa = XCBuildConfiguration;
664+
buildSettings = {
665+
PRODUCT_NAME = "$(TARGET_NAME)";
568666
};
569667
name = Release;
570668
};
@@ -607,6 +705,14 @@
607705
defaultConfigurationIsVisible = 0;
608706
defaultConfigurationName = Release;
609707
};
708+
539F912C16316D2D00160719 /* Build configuration list for PBXAggregateTarget "SDWebImageFramework" */ = {
709+
isa = XCConfigurationList;
710+
buildConfigurations = (
711+
539F912D16316D2D00160719 /* Debug */,
712+
539F912E16316D2D00160719 /* Release */,
713+
);
714+
defaultConfigurationIsVisible = 0;
715+
};
610716
/* End XCConfigurationList section */
611717
};
612718
rootObject = 53922D66148C55810056699D /* Project object */;

0 commit comments

Comments
 (0)