Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKWebView已兼容显示webp动图 #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
58 changes: 23 additions & 35 deletions BAWKWebView-WebP.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
2F07DB7F1F316A6600591F87 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2F07DB7E1F316A6600591F87 /* Assets.xcassets */; };
2F07DB821F316A6600591F87 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2F07DB801F316A6600591F87 /* LaunchScreen.storyboard */; };
2F07DB921F31725600591F87 /* BAWebpController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F07DB911F31725600591F87 /* BAWebpController.m */; };
461460C02521D80D000A43FB /* NSObject+RuntimeInvoker.m in Sources */ = {isa = PBXBuildFile; fileRef = 461460BF2521D80D000A43FB /* NSObject+RuntimeInvoker.m */; };
60A835DFB6D4CE808DC2ACFB /* libPods-BAWKWebView-WebP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FC0889131276AE7F58D8BE0D /* libPods-BAWKWebView-WebP.a */; };
C4C3BE131F31D360009B89D4 /* NSURLProtocol+BAWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = C4BEC3F51F31C71800A2054F /* NSURLProtocol+BAWebView.m */; };
C4C3BE141F31D360009B89D4 /* BAURLSessionProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = C4BEC3F21F31C71800A2054F /* BAURLSessionProtocol.m */; };
Expand All @@ -33,6 +34,8 @@
2F07DB831F316A6600591F87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2F07DB901F31725600591F87 /* BAWebpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BAWebpController.h; sourceTree = "<group>"; };
2F07DB911F31725600591F87 /* BAWebpController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BAWebpController.m; sourceTree = "<group>"; };
461460BE2521D80D000A43FB /* NSObject+RuntimeInvoker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+RuntimeInvoker.h"; sourceTree = "<group>"; };
461460BF2521D80D000A43FB /* NSObject+RuntimeInvoker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+RuntimeInvoker.m"; sourceTree = "<group>"; };
C4BEC3F11F31C71800A2054F /* BAURLSessionProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAURLSessionProtocol.h; sourceTree = "<group>"; };
C4BEC3F21F31C71800A2054F /* BAURLSessionProtocol.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BAURLSessionProtocol.m; sourceTree = "<group>"; };
C4BEC3F31F31C71800A2054F /* BAWKWebView_WebP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAWKWebView_WebP.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -99,9 +102,19 @@
name = "Supporting Files";
sourceTree = "<group>";
};
461460BD2521D80D000A43FB /* JKInvoker */ = {
isa = PBXGroup;
children = (
461460BE2521D80D000A43FB /* NSObject+RuntimeInvoker.h */,
461460BF2521D80D000A43FB /* NSObject+RuntimeInvoker.m */,
);
path = JKInvoker;
sourceTree = "<group>";
};
C4BEC3F01F31C71800A2054F /* BAWKWebView-WebP */ = {
isa = PBXGroup;
children = (
461460BD2521D80D000A43FB /* JKInvoker */,
C4BEC3F11F31C71800A2054F /* BAURLSessionProtocol.h */,
C4BEC3F21F31C71800A2054F /* BAURLSessionProtocol.m */,
C4BEC3F31F31C71800A2054F /* BAWKWebView_WebP.h */,
Expand Down Expand Up @@ -139,8 +152,6 @@
2F07DB6B1F316A6600591F87 /* Sources */,
2F07DB6C1F316A6600591F87 /* Frameworks */,
2F07DB6D1F316A6600591F87 /* Resources */,
058224387ED777999BE43788 /* [CP] Embed Pods Frameworks */,
623A3DB3A6E321F9A2706320 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -172,6 +183,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -199,49 +211,22 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
058224387ED777999BE43788 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
623A3DB3A6E321F9A2706320 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BAWKWebView-WebP/Pods-BAWKWebView-WebP-resources.sh\"\n";
showEnvVarsInLog = 0;
};
6AA7E8A1F9BE664BA6F91F11 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-BAWKWebView-WebP-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand All @@ -257,6 +242,7 @@
2F07DB921F31725600591F87 /* BAWebpController.m in Sources */,
C4C3BE131F31D360009B89D4 /* NSURLProtocol+BAWebView.m in Sources */,
C4C3BE141F31D360009B89D4 /* BAURLSessionProtocol.m in Sources */,
461460C02521D80D000A43FB /* NSObject+RuntimeInvoker.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -323,7 +309,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -365,7 +351,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand All @@ -379,6 +365,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = JB3QR65942;
INFOPLIST_FILE = "BAWKWebView-WebP/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.boai.BAWKWebView-WebP";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -392,6 +379,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = JB3QR65942;
INFOPLIST_FILE = "BAWKWebView-WebP/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.boai.BAWKWebView-WebP";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>BAWKWebView-WebP.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "87D99125-4285-4289-A272-18502FAA532C"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "3207E652-0E1A-43E2-BEB5-4830102268FD"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
breakpointStackSelectionBehavior = "1"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
6 changes: 6 additions & 0 deletions BAWKWebView-WebP/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "AppDelegate.h"
#import "ViewController.h"
#import <SDWebImageWebPCoder/SDImageWebPCoder.h>

@interface AppDelegate ()

Expand All @@ -24,6 +25,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
[self.window setRootViewController:nav];
[self.window makeKeyAndVisible];

/// 添加Webp格式解码
[SDImageCodersManager.sharedManager addCoder:[SDImageWebPCoder sharedCoder]];
[SDWebImageDownloader.sharedDownloader setValue:@"image/webp,image/*,*/*;q=0.8" forHTTPHeaderField:@"Accept"];

return YES;
}

Expand Down
Loading