├── .gitignore ├── Example ├── Gemfile ├── KSOpenApiManager │ ├── KSOpenApiManager+Auth.h │ ├── KSOpenApiManager+Auth.m │ ├── KSOpenApiManager+Media.h │ ├── KSOpenApiManager+Media.m │ ├── KSOpenApiManager+Message.h │ ├── KSOpenApiManager+Message.m │ ├── KSOpenApiManager+Profile.h │ ├── KSOpenApiManager+Profile.m │ ├── KSOpenApiManager+Utils.h │ ├── KSOpenApiManager+Utils.m │ ├── KSOpenApiManager.h │ └── KSOpenApiManager.m ├── KwaiOpenSDKDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── KwaiOpenSDKDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── KwaiOpenSDKDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── KSDemoViewController.h │ ├── KSDemoViewController.m │ ├── KSDemoViewController.xib │ ├── KSMediaViewController.h │ ├── KSMediaViewController.m │ ├── KSShareMessageViewController.h │ ├── KSShareMessageViewController.m │ ├── KSShareMessageViewController.xib │ ├── KwaiOpenSDKDemo.entitlements │ ├── KwaiOpenSDKDemo.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── KwaiOpenSDKDemoDebug.entitlements │ └── main.m ├── Podfile └── ReadMeImages │ └── associated_domains.png ├── KwaiSDK.podspec ├── README.md └── libKwaiSDK ├── Headers ├── KSApi.h └── KSApiObject.h ├── KwaiSDK.podspec.json ├── ios └── libKwaiSDK.a └── source.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | # *.xcworkspace 43 | 44 | # We recommend against adding the Pods directory to your .gitignore. However 45 | # you should judge for yourself, the pros and cons are mentioned at: 46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 47 | # 48 | Pods/ 49 | 50 | # Carthage 51 | # 52 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 53 | # Carthage/Checkouts 54 | 55 | Carthage/Build/ 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. 60 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 63 | 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots/**/*.png 67 | fastlane/test_output 68 | 69 | # Code Injection 70 | # 71 | # After new code Injection tools there's a generated folder /iOSInjectionProject 72 | # https://github.com/johnno1962/injectionforxcode 73 | 74 | iOSInjectionProject/ 75 | .DS_Store 76 | -------------------------------------------------------------------------------- /Example/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "fastlane", "=2.116.1" 4 | gem "cocoapods", "=1.7.5" 5 | gem 'gitlab', "=4.12.0" 6 | plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') 7 | eval_gemfile(plugins_path) if File.exist?(plugins_path) 8 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Auth.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Auth.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | // 具体使用说明: https://open.kuaishou.com/platform/openApi?menu=10 9 | 10 | #import 11 | #import "KSOpenApiManager.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface KSOpenApiManager (Auth) 16 | 17 | - (void)loginWithoutH5; 18 | - (void)loginWithH5Container:(UIViewController *)h5Controller; 19 | 20 | - (void)cleanLoginInfo; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Auth.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Auth.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "KSOpenApiManager+Auth.h" 10 | #import "KSOpenApiManager+Utils.h" 11 | 12 | @implementation KSOpenApiManager (Auth) 13 | 14 | - (void)loginWithoutH5 { 15 | KSAuthRequest *req = [[KSAuthRequest alloc] init]; 16 | req.requiredScope = @"user_info"; 17 | req.applicationList = [self.applicationList copy]; 18 | 19 | __weak __typeof(self) ws = self; 20 | [KSApi sendRequest:req completion:^(BOOL success) { 21 | __strong __typeof(ws) ss = ws; 22 | [ss logFormat:@"%s success: %@", __func__, success ? @"YES" : @"NO"]; 23 | }]; 24 | } 25 | 26 | - (void)loginWithH5Container:(UIViewController *)h5Controller { 27 | KSAuthRequest *req = [[KSAuthRequest alloc] init]; 28 | req.requiredScope = @"user_info"; 29 | req.applicationList = [self.applicationList copy]; 30 | req.h5AuthViewController = h5Controller; 31 | 32 | __weak __typeof(self) ws = self; 33 | [KSApi sendRequest:req completion:^(BOOL success) { 34 | __strong __typeof(ws) ss = ws; 35 | [ss logFormat:@"%s success: %@", __func__, success ? @"YES" : @"NO"]; 36 | }]; 37 | } 38 | 39 | - (void)cleanLoginInfo { 40 | if (!self.universalLink || !self.appId) { 41 | return; 42 | } 43 | NSString *urlString = [NSString pathWithComponents:@[self.universalLink, self.appId, @"share_media?result=100200112&message=Invalid%2520universalLink&errorDomain=-5000"]]; 44 | NSURL *url = [NSURL URLWithString:urlString]; 45 | NSUserActivity *activity = [[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb]; 46 | activity.webpageURL = url; 47 | [KSApi handleOpenUniversalLink:activity]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Media.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Media.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | // 具体使用说明: https://open.kuaishou.com/platform/openApi?menu=10 9 | // NOTE: 需要Info.plist添加键值NSPhotoLibraryUsageDescription 10 | 11 | #import 12 | #import 13 | 14 | #import "KSOpenApiManager.h" 15 | #import 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | @class KSShareMedia; 20 | 21 | @interface KSOpenApiManager (Media) 22 | 23 | - (void)shareMedia:(KSShareMedia *)shareMedia 24 | shareItems:(NSArray *)shareItems 25 | thumbnail:(KSShareMediaAsset *)thumbnail 26 | completion:(void(^)(BOOL))completion; 27 | 28 | @end 29 | 30 | #pragma mark - 31 | 32 | @interface KSShareMedia : NSObject 33 | @property (nonatomic, assign) KSShareMediaFeature feature; 34 | @property (nonatomic, assign) BOOL disableFallback; 35 | 36 | @property (nonatomic, copy) PHAsset *thumbnail; 37 | @property (nonatomic, copy) NSArray *assets; 38 | 39 | // NOTE: 首次测试不要填充, 涉及权限,有可能失败 40 | @property (nonatomic, strong) NSMutableArray *tags; 41 | @property (nonatomic, strong) NSMutableDictionary *extraEntity; 42 | 43 | @property (nonatomic, assign) KSMediaAssociateType associateType; 44 | @property (nonatomic, strong) KSMediaAssociateObject *associateObject; 45 | 46 | - (void)share:(void(^)(BOOL))completion; 47 | 48 | #pragma mark - 49 | 50 | - (BOOL)firstAssetIsImage; 51 | 52 | @end 53 | 54 | NS_ASSUME_NONNULL_END 55 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Media.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Media.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "KSOpenApiManager+Media.h" 10 | #import "KSOpenApiManager+Utils.h" 11 | #import 12 | 13 | @implementation KSOpenApiManager (Media) 14 | 15 | - (void)shareMedia:(KSShareMedia *)shareMedia 16 | shareItems:(NSArray *)shareItems 17 | thumbnail:(KSShareMediaAsset *)thumbnail 18 | completion:(void (^)(BOOL))completion { 19 | 20 | KSShareMediaObject *mediaItem = [[KSShareMediaObject alloc] init]; 21 | //建议为NO, 即执行兜底逻辑,无相关发布权限时进入预裁剪页 22 | mediaItem.disableFallback = shareMedia.disableFallback; 23 | mediaItem.extraEntity = shareMedia.extraEntity; 24 | mediaItem.tags = shareMedia.tags; 25 | 26 | mediaItem.coverAsset = thumbnail; 27 | mediaItem.multipartAssets = shareItems; 28 | 29 | mediaItem.associateType = shareMedia.associateType; 30 | mediaItem.associateObject = shareMedia.associateObject; 31 | 32 | KSShareMediaRequest *request = [[KSShareMediaRequest alloc] init]; 33 | request.applicationList = [self.applicationList copy]; 34 | request.mediaFeature = shareMedia.feature; 35 | request.mediaObject = mediaItem; 36 | __weak __typeof(self) ws = self; 37 | [KSApi sendRequest:request completion:^(BOOL success) { 38 | __strong __typeof(ws) ss = ws; 39 | [ss logFormat:@"%s success: %@", __func__, success ? @"YES" : @"NO"]; 40 | completion ? completion(success) : nil; 41 | }]; 42 | } 43 | 44 | @end 45 | 46 | @implementation KSShareMedia 47 | 48 | - (instancetype)init { 49 | self = [super init]; 50 | if (self) { 51 | _disableFallback = NO; 52 | _assets = [NSMutableArray arrayWithCapacity:10]; 53 | _tags = [NSMutableArray arrayWithCapacity:10]; 54 | } 55 | return self; 56 | } 57 | 58 | - (void)share:(void(^)(BOOL))completion { 59 | if (self.assets.count == 0) { 60 | [[KSOpenApiManager shared] logFormat:@"%s assets count is 0", __func__]; 61 | completion ? completion(NO) : nil; 62 | return; 63 | } 64 | if (self.thumbnail && self.thumbnail.mediaType != PHAssetMediaTypeImage) { 65 | [[KSOpenApiManager shared] logFormat:@"%s thumbnail mediaType isn't image", __func__]; 66 | completion ? completion(NO) : nil; 67 | return; 68 | } 69 | 70 | NSMutableArray *shareItems = [NSMutableArray arrayWithCapacity:self.assets.count]; 71 | for (PHAsset *asset in self.assets) { 72 | NSString *assetId = asset.localIdentifier; 73 | BOOL isImage = asset.mediaType == PHAssetMediaTypeImage; 74 | [shareItems addObject:[KSShareMediaAsset assetForPhotoLibrary:assetId isImage:isImage]]; 75 | } 76 | KSShareMediaAsset *thumbnailItem = [KSShareMediaAsset assetForPhotoLibrary:self.thumbnail.localIdentifier isImage:YES]; 77 | 78 | [[KSOpenApiManager shared] shareMedia:self shareItems:shareItems thumbnail:thumbnailItem completion:completion]; 79 | } 80 | 81 | #pragma mark - 82 | 83 | - (BOOL)firstAssetIsImage { 84 | return self.assets.firstObject.mediaType == PHAssetMediaTypeImage; 85 | } 86 | 87 | @end 88 | 89 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Message.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Message.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KSOpenApiManager.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface KSOpenApiManager (Message) 15 | 16 | - (void)shareMesssageTo:(NSString *)receiverOpenID 17 | title:(NSString *)title 18 | desc:(NSString *)desc 19 | link:(NSString *)link 20 | thumbImage:(NSData *)imageData 21 | extraInfo:(NSDictionary *)info; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Message.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Message.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "KSOpenApiManager+Message.h" 10 | #import "KSOpenApiManager+Utils.h" 11 | 12 | @implementation KSOpenApiManager (Message) 13 | 14 | - (void)shareMesssageTo:(NSString *)receiverOpenID 15 | title:(NSString *)title 16 | desc:(NSString *)desc 17 | link:(NSString *)link 18 | thumbImage:(NSData *)imageData 19 | extraInfo:(NSDictionary *)info { 20 | 21 | KSShareWebPageObject *shareObject = [[KSShareWebPageObject alloc] init]; 22 | shareObject.title = title; 23 | shareObject.desc = desc; 24 | shareObject.linkURL = link; 25 | shareObject.thumbImage = imageData; 26 | 27 | KSShareMessageRequest *req = [[KSShareMessageRequest alloc] init]; 28 | req.applicationList = [self.applicationList copy]; 29 | req.shareScene = KSShareScopeSession; 30 | req.shareObject = shareObject; 31 | //NOTE: receiverOpenID为空时, 快手会显示好友列表请用户选择 32 | //NOTE: receiverOpenID为@""时, 会调用异常, 请注意区别 33 | req.receiverOpenID = receiverOpenID; 34 | if (req.receiverOpenID) { 35 | //NOTE: 如果指定了receiverOpenID,那么openID为空会报错 36 | //NOTE: 因为在指定接收用户的场景下,需要发送方的id去校验用户关系 37 | req.openID = [self selfOpenID]; 38 | } 39 | req.state = @"test share state"; 40 | 41 | __weak __typeof(self) ws = self; 42 | [KSApi sendRequest:req completion:^(BOOL success) { 43 | __strong __typeof(ws) ss = ws; 44 | [ss logFormat:@"%s success: %@", __func__, success ? @"YES" : @"NO"]; 45 | }]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Profile.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Profile.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KSOpenApiManager.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface KSOpenApiManager (Profile) 15 | 16 | - (void)showProfile:(NSString *)targetOpenId; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Profile.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Profile.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | // 具体使用说明: https://open.kuaishou.com/platform/openApi?menu=10 9 | 10 | #import "KSOpenApiManager+Profile.h" 11 | #import "KSOpenApiManager+Utils.h" 12 | 13 | @implementation KSOpenApiManager (Profile) 14 | 15 | - (void)showProfile:(NSString *)targetOpenId { 16 | KSShowProfileRequest *req = [[KSShowProfileRequest alloc] init]; 17 | req.applicationList = [self.applicationList copy]; 18 | req.targetOpenID = targetOpenId; 19 | req.state = @"test profile state"; 20 | __weak __typeof(self) ws = self; 21 | [KSApi sendRequest:req completion:^(BOOL success) { 22 | __strong __typeof(ws) ss = ws; 23 | [ss logFormat:@"%s success: %@", __func__, success ? @"YES" : @"NO"]; 24 | }]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Utils.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KSOpenApiManager.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface KSOpenApiManager (Utils) 15 | 16 | // Log输出 17 | - (void)log:(NSObject *)logObj; 18 | - (void)logFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); 19 | 20 | // Demo功能: 切换AppId 21 | - (NSString *)readAppId; 22 | - (void)saveAppId:(NSString *)appId; 23 | 24 | // Demo功能: 演示如何从code中获得openId 25 | - (void)getOpenIDFromCode:(NSString *)code completion:(void(^)(NSString *, NSError *))completion; 26 | 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager+Utils.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager+Utils.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "KSOpenApiManager+Utils.h" 10 | 11 | @implementation KSOpenApiManager (Utils) 12 | 13 | #pragma mark - Log 14 | 15 | - (void)log:(NSObject *)logObj { 16 | // TODO: 替换成您自己的实际处理,输出到您的日志系统 17 | self.logBlock ? self.logBlock(logObj) : nil; 18 | } 19 | 20 | - (void)logFormat:(NSString *)format, ... { 21 | va_list args; 22 | va_start(args, format); 23 | NSString *customMessage = [[NSString alloc] initWithFormat:format arguments:args]; 24 | va_end(args); 25 | [self log:customMessage]; 26 | } 27 | 28 | #pragma mark - Demo: change appId 29 | 30 | - (NSString *)readAppId { 31 | NSString *appId = [[NSUserDefaults standardUserDefaults] stringForKey:@"fake_appId"]; 32 | if (appId.length == 0) { 33 | appId = kKSAppIdRelease; 34 | } 35 | return appId; 36 | } 37 | 38 | - (void)saveAppId:(NSString *)appId { 39 | [[NSUserDefaults standardUserDefaults] setObject:appId forKey:@"fake_appId"]; 40 | } 41 | 42 | 43 | #pragma mark - Demo: fetch openId 44 | // NOTE: 获得openId应该由服务器端实现,请参照https://open.kuaishou.com/platform/openApi?menu=55 45 | // NOTE: 此函数仅为演示及快速测试Demo功能,线上请勿将appSecret存储于客户端 46 | - (void)getOpenIDFromCode:(NSString *)code completion:(void(^)(NSString *, NSError *))completion { 47 | NSString *appSecret = @""; 48 | 49 | if (!code || code.length == 0) { 50 | NSError *error = [NSError errorWithDomain:NSArgumentDomain code:-1 userInfo:@{ 51 | NSLocalizedDescriptionKey: @"code is nil" 52 | }]; 53 | completion ? completion(nil, error): nil; 54 | return; 55 | } 56 | NSString *appId = [self appId]; 57 | 58 | 59 | if (appSecret.length == 0) { 60 | NSError *error = [NSError errorWithDomain:NSArgumentDomain code:-1 userInfo:@{ 61 | NSLocalizedDescriptionKey: @"appSecret is nil" 62 | }]; 63 | completion ? completion(nil, error): nil; 64 | return; 65 | } else { 66 | [self logFormat:@"%s 仅限演示, appSecret请妥善保存", __func__]; 67 | } 68 | 69 | // https://open.kuaishou.com/platform/openApi?menu=13 70 | NSString *urlString = [NSString stringWithFormat: 71 | @"https://open.kuaishou.com/oauth2/access_token?grant_type=code&app_id=%@&app_secret=%@&code=%@", 72 | appId, appSecret, code]; 73 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] 74 | initWithURL:[NSURL URLWithString:urlString]]; 75 | [request setHTTPMethod:@"GET"]; 76 | NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { 77 | NSString *openId = nil; 78 | if (((NSHTTPURLResponse *)response).statusCode == 200){ 79 | NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL]; 80 | if (json[@"open_id"]){ 81 | openId = json[@"open_id"]; 82 | } 83 | } 84 | dispatch_async(dispatch_get_main_queue(), ^{ 85 | completion ? completion(openId, error): nil; 86 | }); 87 | }]; 88 | [dataTask resume]; 89 | } 90 | 91 | @end 92 | 93 | 94 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | FOUNDATION_EXPORT NSString *const kKSAppIdTest; 15 | FOUNDATION_EXPORT NSString *const kKSAppIdRelease; 16 | 17 | typedef void(^DidLoginBlock)(NSString *code, NSError *error); 18 | typedef void(^ActionCallbackBlock)(NSString *state, NSError *error); 19 | typedef void(^LogBlock)(NSObject *log); 20 | 21 | @interface KSOpenApiManager : NSObject 22 | 23 | @property (nonatomic, copy, readonly) NSString *appId; 24 | @property (nonatomic, copy, readonly) NSString *universalLink; 25 | 26 | @property (nonatomic, strong) NSMutableArray *applicationList; 27 | @property (nonatomic, copy) NSString *selfOpenID; 28 | 29 | // NOTE: Demo UI显示使用, 请更新成自身操作 30 | @property (nonatomic, copy) DidLoginBlock loginBlock; 31 | @property (nonatomic, copy) ActionCallbackBlock actionBlock; 32 | @property (nonatomic, copy) LogBlock logBlock; 33 | 34 | + (instancetype)shared; 35 | 36 | - (void)registerKwaiOpenSDK; 37 | 38 | - (BOOL)handleOpenURL:(NSURL *)url; 39 | - (BOOL)handleUserActivity:(nonnull NSUserActivity *)userActivity; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /Example/KSOpenApiManager/KSOpenApiManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSOpenApiManager.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | // 快手文档: https://open.kuaishou.com/platform/openApi?menu=9 9 | 10 | #import "KSOpenApiManager.h" 11 | #import "KSOpenApiManager+Utils.h" 12 | 13 | // TODO: 按您网站注册信息,进行配置 14 | NSString *const kKSAppIdTest = @"ks*******"; 15 | NSString *const kKSAppIdRelease = @"ks******"; 16 | NSString *const kKSUniversalLink = @"****网站注册时, 相同的universal link, 以/结尾****"; 17 | 18 | #pragma mark - 19 | 20 | @interface KSOpenApiManager () 21 | 22 | @property (nonatomic, copy) NSString *appId; 23 | @property (nonatomic, copy) NSString *universalLink; 24 | 25 | @end 26 | 27 | @implementation KSOpenApiManager 28 | 29 | + (instancetype)shared { 30 | static KSOpenApiManager *gIns = nil; 31 | static dispatch_once_t onceToken; 32 | dispatch_once(&onceToken, ^{ 33 | gIns = [[KSOpenApiManager alloc] init]; 34 | }); 35 | return gIns; 36 | } 37 | 38 | - (instancetype)init { 39 | self = [super init]; 40 | if (self) { 41 | // TODO: 按需修改 42 | _appId = [self readAppId]; 43 | _universalLink = kKSUniversalLink; 44 | _applicationList = [@[] mutableCopy]; //!< 为空时,目标应用仅为快手 45 | // 目标应用为快手或快手极速版 46 | // _applicationList = [@[@(KSApiApplication_Kwai), @(KSApiApplication_KwaiLite)] mutableCopy]; 47 | } 48 | return self; 49 | } 50 | 51 | - (void)registerKwaiOpenSDK { 52 | // TODO: 请按文档检查工程配置 https://open.kuaishou.com/platform/openApi?menu=9 53 | [KSApi startLogByLevel:KwaiSDKLogLevelDetail logDelegate:self]; 54 | [KSApi registerApp:self.appId universalLink:self.universalLink delegate:self]; 55 | } 56 | 57 | #pragma mark - 快手回调入口 58 | 59 | - (BOOL)handleUserActivity:(nonnull NSUserActivity *)userActivity { 60 | // 处理Universal link方式回调 61 | // NOTE: 请配置Associated Domains 添加applinks: **您的apple-app-site-association文件所在域名** 62 | // NOTE: 可用备忘录点击链接, 测试是否可跳转成功 63 | /// 苹果Universal Link官方文档: https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1 64 | 65 | [self log:userActivity.webpageURL]; 66 | return [KSApi handleOpenUniversalLink:userActivity]; 67 | } 68 | 69 | - (BOOL)handleOpenURL:(NSURL *)url { 70 | // Scheme方式回调, Universal link方式失败时 71 | // NOTE: 请配置Info.plist URL Types字段, 支持被调起 72 | // NOTE: 请配置Info.plist LSApplicationQueriesSchemes字段,支持调起快手 73 | [self log:url]; 74 | return [KSApi handleOpenURL:url]; 75 | } 76 | 77 | #pragma mark -- KSApiDelegate 78 | 79 | - (void)ksApiDidReceiveResponse:(__kindof KSBaseResponse *)response { 80 | // SDK最终结果 81 | if ([response isKindOfClass:[KSAuthResponse class]]){ 82 | KSAuthResponse *authResponse = (KSAuthResponse *)response; 83 | NSString *log = [NSString stringWithFormat:@"auth code: %@ state: %@ errorCode: %@ msg: %@", 84 | authResponse.code, authResponse.state, @(authResponse.error.code), response.error.localizedDescription]; 85 | [self log:log]; 86 | 87 | // TODO: 替换成您自己的实际处理 88 | self.loginBlock ? self.loginBlock(authResponse.code, authResponse.error): nil; 89 | } else { 90 | 91 | NSString *log = [NSString stringWithFormat:@"responseType:%@, errorCode:%d state: %@ msg: %@", [response.class description], 92 | (int)response.error.code, response.state, response.error.localizedDescription]; 93 | [self log:log]; 94 | 95 | // TODO: 替换成您自己的实际处理 96 | self.actionBlock ? self.actionBlock(response.state, response.error): nil; 97 | } 98 | } 99 | 100 | #pragma mark - KwaiSDKLogDelegate 101 | 102 | - (void)onLog:(NSString*)log logLevel:(KwaiSDKLogLevel)level { 103 | [self logFormat:@"[%@] %@", level == KwaiSDKLogLevelNormal ? @"N" : @"D", log]; 104 | } 105 | 106 | - (void)onStatistics:(NSString*)key value:(NSString *)value { 107 | [self logFormat:@"[Stat] %@:%@", key, value]; 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6BAF8977BABB844C677EBD27 /* Pods_KwaiOpenSDKDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B42BB06A4F16042C13CFCDA /* Pods_KwaiOpenSDKDemo.framework */; }; 11 | BB81F05828892AAB003C22B6 /* KSOpenApiManager+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = BB81F05728892AAB003C22B6 /* KSOpenApiManager+Utils.m */; }; 12 | BBADB1D2288002D1006F7869 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB1D1288002D1006F7869 /* AppDelegate.m */; }; 13 | BBADB1D8288002D1006F7869 /* KSDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB1D7288002D1006F7869 /* KSDemoViewController.m */; }; 14 | BBADB1DB288002D1006F7869 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BBADB1D9288002D1006F7869 /* Main.storyboard */; }; 15 | BBADB1DD288002D3006F7869 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BBADB1DC288002D3006F7869 /* Assets.xcassets */; }; 16 | BBADB1E0288002D3006F7869 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BBADB1DE288002D3006F7869 /* LaunchScreen.storyboard */; }; 17 | BBADB1E3288002D3006F7869 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB1E2288002D3006F7869 /* main.m */; }; 18 | BBADB2C128801823006F7869 /* KSOpenApiManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2C028801823006F7869 /* KSOpenApiManager.m */; }; 19 | BBADB2C428801AC0006F7869 /* KSOpenApiManager+Auth.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2C328801AC0006F7869 /* KSOpenApiManager+Auth.m */; }; 20 | BBADB2CA28801B23006F7869 /* KSOpenApiManager+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2C928801B23006F7869 /* KSOpenApiManager+Message.m */; }; 21 | BBADB2CD28801B3B006F7869 /* KSOpenApiManager+Media.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2CC28801B3B006F7869 /* KSOpenApiManager+Media.m */; }; 22 | BBADB2D028801B4F006F7869 /* KSOpenApiManager+Profile.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2CF28801B4F006F7869 /* KSOpenApiManager+Profile.m */; }; 23 | BBADB2D328801D3A006F7869 /* KSShareMessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2D128801D3A006F7869 /* KSShareMessageViewController.m */; }; 24 | BBADB2D8288030D1006F7869 /* KSMediaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2D6288030D1006F7869 /* KSMediaViewController.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 9B42BB06A4F16042C13CFCDA /* Pods_KwaiOpenSDKDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KwaiOpenSDKDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | AF1390DF373C0C0298E43A9B /* Pods-KwaiOpenSDKDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KwaiOpenSDKDemo.debug.xcconfig"; path = "Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo.debug.xcconfig"; sourceTree = ""; }; 30 | BB81F05628892AAB003C22B6 /* KSOpenApiManager+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Utils.h"; sourceTree = ""; }; 31 | BB81F05728892AAB003C22B6 /* KSOpenApiManager+Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Utils.m"; sourceTree = ""; }; 32 | BBADB1CD288002D1006F7869 /* KwaiOpenSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KwaiOpenSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | BBADB1D0288002D1006F7869 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 34 | BBADB1D1288002D1006F7869 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 35 | BBADB1D6288002D1006F7869 /* KSDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSDemoViewController.h; sourceTree = ""; }; 36 | BBADB1D7288002D1006F7869 /* KSDemoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSDemoViewController.m; sourceTree = ""; }; 37 | BBADB1DA288002D1006F7869 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | BBADB1DC288002D3006F7869 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 39 | BBADB1DF288002D3006F7869 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 40 | BBADB1E1288002D3006F7869 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | BBADB1E2288002D3006F7869 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | BBADB2BD28801153006F7869 /* KwaiOpenSDKDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = KwaiOpenSDKDemo.entitlements; sourceTree = ""; }; 43 | BBADB2C028801823006F7869 /* KSOpenApiManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSOpenApiManager.m; sourceTree = ""; }; 44 | BBADB2C228801AC0006F7869 /* KSOpenApiManager+Auth.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Auth.h"; sourceTree = ""; }; 45 | BBADB2C328801AC0006F7869 /* KSOpenApiManager+Auth.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Auth.m"; sourceTree = ""; }; 46 | BBADB2C528801AF9006F7869 /* KSOpenApiManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSOpenApiManager.h; sourceTree = ""; }; 47 | BBADB2C828801B23006F7869 /* KSOpenApiManager+Message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Message.h"; sourceTree = ""; }; 48 | BBADB2C928801B23006F7869 /* KSOpenApiManager+Message.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Message.m"; sourceTree = ""; }; 49 | BBADB2CB28801B3B006F7869 /* KSOpenApiManager+Media.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Media.h"; sourceTree = ""; }; 50 | BBADB2CC28801B3B006F7869 /* KSOpenApiManager+Media.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Media.m"; sourceTree = ""; }; 51 | BBADB2CE28801B4F006F7869 /* KSOpenApiManager+Profile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Profile.h"; sourceTree = ""; }; 52 | BBADB2CF28801B4F006F7869 /* KSOpenApiManager+Profile.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Profile.m"; sourceTree = ""; }; 53 | BBADB2D128801D3A006F7869 /* KSShareMessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSShareMessageViewController.m; sourceTree = ""; }; 54 | BBADB2D228801D3A006F7869 /* KSShareMessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSShareMessageViewController.h; sourceTree = ""; }; 55 | BBADB2D6288030D1006F7869 /* KSMediaViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSMediaViewController.m; sourceTree = ""; }; 56 | BBADB2D7288030D1006F7869 /* KSMediaViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSMediaViewController.h; sourceTree = ""; }; 57 | BBF93C76288EBC75001A532C /* KwaiOpenSDKDemoDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = KwaiOpenSDKDemoDebug.entitlements; sourceTree = ""; }; 58 | D562A8D44B40E802F0C97D93 /* Pods-KwaiOpenSDKDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KwaiOpenSDKDemo.release.xcconfig"; path = "Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo.release.xcconfig"; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | BBADB1CA288002D1006F7869 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | 6BAF8977BABB844C677EBD27 /* Pods_KwaiOpenSDKDemo.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 0894DA9AF7B12A686C29773B /* Frameworks */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 9B42BB06A4F16042C13CFCDA /* Pods_KwaiOpenSDKDemo.framework */, 77 | ); 78 | name = Frameworks; 79 | sourceTree = ""; 80 | }; 81 | 149C0616F01FCD6133684DB0 /* Pods */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | AF1390DF373C0C0298E43A9B /* Pods-KwaiOpenSDKDemo.debug.xcconfig */, 85 | D562A8D44B40E802F0C97D93 /* Pods-KwaiOpenSDKDemo.release.xcconfig */, 86 | ); 87 | path = Pods; 88 | sourceTree = ""; 89 | }; 90 | BBADB1C4288002D1006F7869 = { 91 | isa = PBXGroup; 92 | children = ( 93 | BBADB1CF288002D1006F7869 /* KwaiOpenSDKDemo */, 94 | BBADB1CE288002D1006F7869 /* Products */, 95 | 149C0616F01FCD6133684DB0 /* Pods */, 96 | 0894DA9AF7B12A686C29773B /* Frameworks */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | BBADB1CE288002D1006F7869 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | BBADB1CD288002D1006F7869 /* KwaiOpenSDKDemo.app */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | BBADB1CF288002D1006F7869 /* KwaiOpenSDKDemo */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | BBF93C76288EBC75001A532C /* KwaiOpenSDKDemoDebug.entitlements */, 112 | BBADB2BD28801153006F7869 /* KwaiOpenSDKDemo.entitlements */, 113 | BBADB2BE28801823006F7869 /* KSOpenApiManager */, 114 | BBADB1D0288002D1006F7869 /* AppDelegate.h */, 115 | BBADB1D1288002D1006F7869 /* AppDelegate.m */, 116 | BBADB1D6288002D1006F7869 /* KSDemoViewController.h */, 117 | BBADB1D7288002D1006F7869 /* KSDemoViewController.m */, 118 | BBADB2D228801D3A006F7869 /* KSShareMessageViewController.h */, 119 | BBADB2D128801D3A006F7869 /* KSShareMessageViewController.m */, 120 | BBADB2D7288030D1006F7869 /* KSMediaViewController.h */, 121 | BBADB2D6288030D1006F7869 /* KSMediaViewController.m */, 122 | BBADB1D9288002D1006F7869 /* Main.storyboard */, 123 | BBADB1DC288002D3006F7869 /* Assets.xcassets */, 124 | BBADB1DE288002D3006F7869 /* LaunchScreen.storyboard */, 125 | BBADB1E1288002D3006F7869 /* Info.plist */, 126 | BBADB1E2288002D3006F7869 /* main.m */, 127 | ); 128 | path = KwaiOpenSDKDemo; 129 | sourceTree = ""; 130 | }; 131 | BBADB2BE28801823006F7869 /* KSOpenApiManager */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | BBADB2C528801AF9006F7869 /* KSOpenApiManager.h */, 135 | BBADB2C028801823006F7869 /* KSOpenApiManager.m */, 136 | BB81F05628892AAB003C22B6 /* KSOpenApiManager+Utils.h */, 137 | BB81F05728892AAB003C22B6 /* KSOpenApiManager+Utils.m */, 138 | BBADB2C228801AC0006F7869 /* KSOpenApiManager+Auth.h */, 139 | BBADB2C328801AC0006F7869 /* KSOpenApiManager+Auth.m */, 140 | BBADB2CE28801B4F006F7869 /* KSOpenApiManager+Profile.h */, 141 | BBADB2CF28801B4F006F7869 /* KSOpenApiManager+Profile.m */, 142 | BBADB2C828801B23006F7869 /* KSOpenApiManager+Message.h */, 143 | BBADB2C928801B23006F7869 /* KSOpenApiManager+Message.m */, 144 | BBADB2CB28801B3B006F7869 /* KSOpenApiManager+Media.h */, 145 | BBADB2CC28801B3B006F7869 /* KSOpenApiManager+Media.m */, 146 | ); 147 | path = KSOpenApiManager; 148 | sourceTree = SOURCE_ROOT; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | BBADB1CC288002D1006F7869 /* KwaiOpenSDKDemo */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = BBADB1E6288002D3006F7869 /* Build configuration list for PBXNativeTarget "KwaiOpenSDKDemo" */; 156 | buildPhases = ( 157 | 069014D784A4CDC571541AEF /* [CP] Check Pods Manifest.lock */, 158 | BBADB1C9288002D1006F7869 /* Sources */, 159 | BBADB1CA288002D1006F7869 /* Frameworks */, 160 | BBADB1CB288002D1006F7869 /* Resources */, 161 | C07AA444397ACACF2F25C2FE /* [CP] Embed Pods Frameworks */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = KwaiOpenSDKDemo; 168 | productName = KwaiOpenSDKDemo; 169 | productReference = BBADB1CD288002D1006F7869 /* KwaiOpenSDKDemo.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | /* End PBXNativeTarget section */ 173 | 174 | /* Begin PBXProject section */ 175 | BBADB1C5288002D1006F7869 /* Project object */ = { 176 | isa = PBXProject; 177 | attributes = { 178 | BuildIndependentTargetsInParallel = 1; 179 | LastUpgradeCheck = 1320; 180 | TargetAttributes = { 181 | BBADB1CC288002D1006F7869 = { 182 | CreatedOnToolsVersion = 13.2.1; 183 | }; 184 | }; 185 | }; 186 | buildConfigurationList = BBADB1C8288002D1006F7869 /* Build configuration list for PBXProject "KwaiOpenSDKDemo" */; 187 | compatibilityVersion = "Xcode 13.0"; 188 | developmentRegion = en; 189 | hasScannedForEncodings = 0; 190 | knownRegions = ( 191 | en, 192 | Base, 193 | ); 194 | mainGroup = BBADB1C4288002D1006F7869; 195 | productRefGroup = BBADB1CE288002D1006F7869 /* Products */; 196 | projectDirPath = ""; 197 | projectRoot = ""; 198 | targets = ( 199 | BBADB1CC288002D1006F7869 /* KwaiOpenSDKDemo */, 200 | ); 201 | }; 202 | /* End PBXProject section */ 203 | 204 | /* Begin PBXResourcesBuildPhase section */ 205 | BBADB1CB288002D1006F7869 /* Resources */ = { 206 | isa = PBXResourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | BBADB1E0288002D3006F7869 /* LaunchScreen.storyboard in Resources */, 210 | BBADB1DD288002D3006F7869 /* Assets.xcassets in Resources */, 211 | BBADB1DB288002D1006F7869 /* Main.storyboard in Resources */, 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | }; 215 | /* End PBXResourcesBuildPhase section */ 216 | 217 | /* Begin PBXShellScriptBuildPhase section */ 218 | 069014D784A4CDC571541AEF /* [CP] Check Pods Manifest.lock */ = { 219 | isa = PBXShellScriptBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | ); 223 | inputFileListPaths = ( 224 | ); 225 | inputPaths = ( 226 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 227 | "${PODS_ROOT}/Manifest.lock", 228 | ); 229 | name = "[CP] Check Pods Manifest.lock"; 230 | outputFileListPaths = ( 231 | ); 232 | outputPaths = ( 233 | "$(DERIVED_FILE_DIR)/Pods-KwaiOpenSDKDemo-checkManifestLockResult.txt", 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | shellPath = /bin/sh; 237 | 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"; 238 | showEnvVarsInLog = 0; 239 | }; 240 | C07AA444397ACACF2F25C2FE /* [CP] Embed Pods Frameworks */ = { 241 | isa = PBXShellScriptBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | ); 245 | inputFileListPaths = ( 246 | "${PODS_ROOT}/Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist", 247 | ); 248 | name = "[CP] Embed Pods Frameworks"; 249 | outputFileListPaths = ( 250 | "${PODS_ROOT}/Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist", 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | shellPath = /bin/sh; 254 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo-frameworks.sh\"\n"; 255 | showEnvVarsInLog = 0; 256 | }; 257 | /* End PBXShellScriptBuildPhase section */ 258 | 259 | /* Begin PBXSourcesBuildPhase section */ 260 | BBADB1C9288002D1006F7869 /* Sources */ = { 261 | isa = PBXSourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | BBADB2CA28801B23006F7869 /* KSOpenApiManager+Message.m in Sources */, 265 | BBADB1D8288002D1006F7869 /* KSDemoViewController.m in Sources */, 266 | BBADB2C128801823006F7869 /* KSOpenApiManager.m in Sources */, 267 | BBADB2C428801AC0006F7869 /* KSOpenApiManager+Auth.m in Sources */, 268 | BBADB2D328801D3A006F7869 /* KSShareMessageViewController.m in Sources */, 269 | BBADB1D2288002D1006F7869 /* AppDelegate.m in Sources */, 270 | BBADB2CD28801B3B006F7869 /* KSOpenApiManager+Media.m in Sources */, 271 | BBADB2D8288030D1006F7869 /* KSMediaViewController.m in Sources */, 272 | BBADB1E3288002D3006F7869 /* main.m in Sources */, 273 | BBADB2D028801B4F006F7869 /* KSOpenApiManager+Profile.m in Sources */, 274 | BB81F05828892AAB003C22B6 /* KSOpenApiManager+Utils.m in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | /* End PBXSourcesBuildPhase section */ 279 | 280 | /* Begin PBXVariantGroup section */ 281 | BBADB1D9288002D1006F7869 /* Main.storyboard */ = { 282 | isa = PBXVariantGroup; 283 | children = ( 284 | BBADB1DA288002D1006F7869 /* Base */, 285 | ); 286 | name = Main.storyboard; 287 | sourceTree = ""; 288 | }; 289 | BBADB1DE288002D3006F7869 /* LaunchScreen.storyboard */ = { 290 | isa = PBXVariantGroup; 291 | children = ( 292 | BBADB1DF288002D3006F7869 /* Base */, 293 | ); 294 | name = LaunchScreen.storyboard; 295 | sourceTree = ""; 296 | }; 297 | /* End PBXVariantGroup section */ 298 | 299 | /* Begin XCBuildConfiguration section */ 300 | BBADB1E4288002D3006F7869 /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ALWAYS_SEARCH_USER_PATHS = NO; 304 | CLANG_ANALYZER_NONNULL = YES; 305 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 306 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 307 | CLANG_CXX_LIBRARY = "libc++"; 308 | CLANG_ENABLE_MODULES = YES; 309 | CLANG_ENABLE_OBJC_ARC = YES; 310 | CLANG_ENABLE_OBJC_WEAK = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 318 | CLANG_WARN_EMPTY_BODY = YES; 319 | CLANG_WARN_ENUM_CONVERSION = YES; 320 | CLANG_WARN_INFINITE_RECURSION = YES; 321 | CLANG_WARN_INT_CONVERSION = YES; 322 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 324 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 326 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 327 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 328 | CLANG_WARN_STRICT_PROTOTYPES = YES; 329 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 330 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | COPY_PHASE_STRIP = NO; 334 | DEBUG_INFORMATION_FORMAT = dwarf; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | ENABLE_TESTABILITY = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu11; 338 | GCC_DYNAMIC_NO_PIC = NO; 339 | GCC_NO_COMMON_BLOCKS = YES; 340 | GCC_OPTIMIZATION_LEVEL = 0; 341 | GCC_PREPROCESSOR_DEFINITIONS = ( 342 | "DEBUG=1", 343 | "$(inherited)", 344 | ); 345 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 346 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 347 | GCC_WARN_UNDECLARED_SELECTOR = YES; 348 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 349 | GCC_WARN_UNUSED_FUNCTION = YES; 350 | GCC_WARN_UNUSED_VARIABLE = YES; 351 | IPHONEOS_DEPLOYMENT_TARGET = 15.2; 352 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 353 | MTL_FAST_MATH = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = iphoneos; 356 | }; 357 | name = Debug; 358 | }; 359 | BBADB1E5288002D3006F7869 /* Release */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | ALWAYS_SEARCH_USER_PATHS = NO; 363 | CLANG_ANALYZER_NONNULL = YES; 364 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_ENABLE_OBJC_WEAK = YES; 370 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_COMMA = YES; 373 | CLANG_WARN_CONSTANT_CONVERSION = YES; 374 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INFINITE_RECURSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 383 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 386 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 387 | CLANG_WARN_STRICT_PROTOTYPES = YES; 388 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 389 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 390 | CLANG_WARN_UNREACHABLE_CODE = YES; 391 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 392 | COPY_PHASE_STRIP = NO; 393 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 394 | ENABLE_NS_ASSERTIONS = NO; 395 | ENABLE_STRICT_OBJC_MSGSEND = YES; 396 | GCC_C_LANGUAGE_STANDARD = gnu11; 397 | GCC_NO_COMMON_BLOCKS = YES; 398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 400 | GCC_WARN_UNDECLARED_SELECTOR = YES; 401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 402 | GCC_WARN_UNUSED_FUNCTION = YES; 403 | GCC_WARN_UNUSED_VARIABLE = YES; 404 | IPHONEOS_DEPLOYMENT_TARGET = 15.2; 405 | MTL_ENABLE_DEBUG_INFO = NO; 406 | MTL_FAST_MATH = YES; 407 | SDKROOT = iphoneos; 408 | VALIDATE_PRODUCT = YES; 409 | }; 410 | name = Release; 411 | }; 412 | BBADB1E7288002D3006F7869 /* Debug */ = { 413 | isa = XCBuildConfiguration; 414 | baseConfigurationReference = AF1390DF373C0C0298E43A9B /* Pods-KwaiOpenSDKDemo.debug.xcconfig */; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 418 | CODE_SIGN_ENTITLEMENTS = KwaiOpenSDKDemo/KwaiOpenSDKDemoDebug.entitlements; 419 | CODE_SIGN_IDENTITY = "Apple Development"; 420 | CODE_SIGN_STYLE = Automatic; 421 | CURRENT_PROJECT_VERSION = 1; 422 | DEVELOPMENT_TEAM = ""; 423 | GENERATE_INFOPLIST_FILE = YES; 424 | INFOPLIST_FILE = KwaiOpenSDKDemo/Info.plist; 425 | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Photo Library Access Warning"; 426 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 427 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 428 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 429 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 430 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 431 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 432 | LD_RUNPATH_SEARCH_PATHS = ( 433 | "$(inherited)", 434 | "@executable_path/Frameworks", 435 | ); 436 | MARKETING_VERSION = 1.0; 437 | PRODUCT_BUNDLE_IDENTIFIER = com.company.app.dev; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | PROVISIONING_PROFILE_SPECIFIER = ""; 440 | SWIFT_EMIT_LOC_STRINGS = YES; 441 | TARGETED_DEVICE_FAMILY = "1,2"; 442 | }; 443 | name = Debug; 444 | }; 445 | BBADB1E8288002D3006F7869 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | baseConfigurationReference = D562A8D44B40E802F0C97D93 /* Pods-KwaiOpenSDKDemo.release.xcconfig */; 448 | buildSettings = { 449 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 450 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 451 | CODE_SIGN_ENTITLEMENTS = KwaiOpenSDKDemo/KwaiOpenSDKDemo.entitlements; 452 | CODE_SIGN_IDENTITY = "Apple Development"; 453 | CODE_SIGN_STYLE = Automatic; 454 | CURRENT_PROJECT_VERSION = 1; 455 | DEVELOPMENT_TEAM = ""; 456 | GENERATE_INFOPLIST_FILE = YES; 457 | INFOPLIST_FILE = KwaiOpenSDKDemo/Info.plist; 458 | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Photo Library Access Warning"; 459 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 460 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 461 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 462 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 463 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 464 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 465 | LD_RUNPATH_SEARCH_PATHS = ( 466 | "$(inherited)", 467 | "@executable_path/Frameworks", 468 | ); 469 | MARKETING_VERSION = 1.0; 470 | PRODUCT_BUNDLE_IDENTIFIER = com.company.app.release; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | PROVISIONING_PROFILE_SPECIFIER = ""; 473 | SWIFT_EMIT_LOC_STRINGS = YES; 474 | TARGETED_DEVICE_FAMILY = "1,2"; 475 | }; 476 | name = Release; 477 | }; 478 | /* End XCBuildConfiguration section */ 479 | 480 | /* Begin XCConfigurationList section */ 481 | BBADB1C8288002D1006F7869 /* Build configuration list for PBXProject "KwaiOpenSDKDemo" */ = { 482 | isa = XCConfigurationList; 483 | buildConfigurations = ( 484 | BBADB1E4288002D3006F7869 /* Debug */, 485 | BBADB1E5288002D3006F7869 /* Release */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | BBADB1E6288002D3006F7869 /* Build configuration list for PBXNativeTarget "KwaiOpenSDKDemo" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | BBADB1E7288002D3006F7869 /* Debug */, 494 | BBADB1E8288002D3006F7869 /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | /* End XCConfigurationList section */ 500 | }; 501 | rootObject = BBADB1C5288002D1006F7869 /* Project object */; 502 | } 503 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "KSOpenApiManager.h" 11 | #import "KSDemoViewController.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | 21 | return YES; 22 | } 23 | 24 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options API_AVAILABLE(ios(9.0)) { 25 | return [[KSOpenApiManager shared] handleOpenURL:url]; 26 | } 27 | 28 | - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { 29 | return [[KSOpenApiManager shared] handleUserActivity:userActivity]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleURLTypes 6 | 7 | 8 | CFBundleTypeRole 9 | Editor 10 | CFBundleURLName 11 | kuaishou_release 12 | CFBundleURLSchemes 13 | 14 | ks685673047210945076 15 | 16 | 17 | 18 | CFBundleTypeRole 19 | Editor 20 | CFBundleURLName 21 | kuaishou_test 22 | CFBundleURLSchemes 23 | 24 | ks685673047210945077 25 | 26 | 27 | 28 | LSApplicationQueriesSchemes 29 | 30 | ksnebula 31 | kwai 32 | kwaiAuth2 33 | kwai.clip.multi 34 | kwaiSDKMediaV2 35 | 36 | NSAppTransportSecurity 37 | 38 | NSAllowsArbitraryLoads 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface KSDemoViewController : UIViewController 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSDemoViewController.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "KSDemoViewController.h" 10 | #import "KSShareMessageViewController.h" 11 | #import "KSMediaViewController.h" 12 | #import "KSOpenApiManager.h" 13 | #import "KSOpenApiManager.h" 14 | #import "KSOpenApiManager+Auth.h" 15 | #import "KSOpenApiManager+Profile.h" 16 | #import "KSOpenApiManager+Utils.h" 17 | 18 | @interface KSDemoViewController () 19 | 20 | @property (strong, nonatomic) IBOutlet UITextView *openIDTextView; 21 | 22 | @property (strong, nonatomic) IBOutlet UISwitch *targetOpenIdSwitch; 23 | @property (strong, nonatomic) IBOutlet UITextView *targetOpenIdTextView; 24 | 25 | @property (weak, nonatomic) IBOutlet UITextView *appIdTextView; 26 | @property (weak, nonatomic) IBOutlet UITextView *targetAppTextView; 27 | 28 | @property (weak, nonatomic) IBOutlet UISegmentedControl *jumpTypeSegmentControl; 29 | 30 | @property (weak, nonatomic) IBOutlet UITextView *logTextView; 31 | @property (weak, nonatomic) IBOutlet UIButton *cleanLogButton; 32 | 33 | @property (weak, nonatomic) IBOutlet UIButton *cleanLoginInfoButton; 34 | @property (weak, nonatomic) IBOutlet UILabel *versionLabel; 35 | 36 | @end 37 | 38 | @implementation KSDemoViewController 39 | 40 | #pragma mark - View Life Cycle 41 | 42 | - (void)viewDidLoad { 43 | [super viewDidLoad]; 44 | [self addGesture]; 45 | self.appIdTextView.delegate = self; 46 | self.targetOpenIdTextView.delegate = self; 47 | self.openIDTextView.delegate = self; 48 | [[KSOpenApiManager shared] registerKwaiOpenSDK]; 49 | [self setupLogView]; 50 | [self setupAppIdView]; 51 | self.versionLabel.text = [NSString stringWithFormat: @"v%@", [KSApi apiVersion]]; 52 | 53 | [self addObservers]; 54 | [self.jumpTypeSegmentControl setEnabled:NO]; 55 | // [self.cleanLoginInfoButton setEnabled:NO]; 56 | [self.view resignFirstResponder]; 57 | } 58 | 59 | #pragma mark - 60 | 61 | - (void)addObservers { 62 | __weak __typeof(self) ws = self; 63 | [[KSOpenApiManager shared] setLoginBlock:^(NSString * _Nonnull code, NSError * _Nonnull error) { 64 | __strong __typeof(ws) ss = ws; 65 | [ss didLogin:code]; 66 | }]; 67 | 68 | [[KSOpenApiManager shared] setActionBlock:^(NSString * _Nonnull state, NSError * _Nonnull error) { 69 | 70 | }]; 71 | 72 | [[KSOpenApiManager shared] setLogBlock:^(NSObject * _Nonnull log) { 73 | __strong __typeof(ws) ss = ws; 74 | NSString *string = [NSString stringWithFormat:@"%@", log]; 75 | [ss textViewAddString:string]; 76 | NSLog(@"%@", string); 77 | }]; 78 | } 79 | 80 | #pragma mark - Gesture 81 | 82 | - (void)addGesture { 83 | UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(endEditing)]; 84 | [self.view addGestureRecognizer:tgr]; 85 | } 86 | 87 | - (void)endEditing { 88 | [self.openIDTextView resignFirstResponder]; 89 | [self.targetOpenIdTextView resignFirstResponder]; 90 | } 91 | 92 | - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { 93 | if([text isEqualToString:@"\n"]) { 94 | [textView resignFirstResponder]; 95 | return NO; 96 | } 97 | return YES; 98 | } 99 | 100 | #pragma mark - 101 | 102 | - (IBAction)login:(id)sender { 103 | [[KSOpenApiManager shared] loginWithH5Container:self]; 104 | } 105 | 106 | - (IBAction)showProfile:(id)sender { 107 | NSString *targetOpenId = self.targetOpenIdTextView.text; 108 | [[KSOpenApiManager shared] showProfile:targetOpenId]; 109 | } 110 | 111 | - (IBAction)shareMessage { 112 | UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; 113 | KSShareMessageViewController * vc = (KSShareMessageViewController *)[sb instantiateViewControllerWithIdentifier:@"shareMessage"]; 114 | [self presentViewController:vc animated:YES completion:nil]; 115 | 116 | if (self.targetOpenIdSwitch.isOn) { 117 | NSString *targetOpenId = self.targetOpenIdTextView.text; 118 | targetOpenId = targetOpenId.length > 0 ? targetOpenId: nil; 119 | vc.receiverOpenId = targetOpenId; 120 | } 121 | } 122 | 123 | - (IBAction)shareMedia:(UIButton *)sender { 124 | UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; 125 | KSMediaViewController * vc = (KSMediaViewController *)[sb instantiateViewControllerWithIdentifier:@"media"]; 126 | [self presentViewController:vc animated:YES completion:nil]; 127 | } 128 | 129 | #pragma mark - Login & Clean Login Info 130 | 131 | - (void)didLogin:(NSString *)code { 132 | __weak __typeof(self) ws = self; 133 | [[KSOpenApiManager shared] getOpenIDFromCode:code completion:^(NSString * _Nonnull openId, NSError * _Nonnull error) { 134 | __strong __typeof(ws) ss = ws; 135 | ss.openIDTextView.text = openId; 136 | if (openId.length) { 137 | [[KSOpenApiManager shared] setSelfOpenID:openId]; 138 | self.targetOpenIdTextView.text = openId; //方便调试,使用自己的id作为targetId 139 | } 140 | }]; 141 | } 142 | 143 | - (IBAction)cleanLoginInfo:(id)sender { 144 | [[KSOpenApiManager shared] cleanLoginInfo]; 145 | } 146 | 147 | #pragma mark - 切换目标App 148 | 149 | - (NSMutableArray *)applicationList { 150 | return [KSOpenApiManager shared].applicationList; 151 | } 152 | 153 | - (IBAction)targetAppKwaiTapped:(id)sender { 154 | if ([self.applicationList containsObject:@(KSApiApplication_Kwai)]) { 155 | [self.applicationList removeObject:@(KSApiApplication_Kwai)]; 156 | } else { 157 | [self.applicationList addObject:@(KSApiApplication_Kwai)]; 158 | } 159 | 160 | __block NSString *str = @""; 161 | [self.applicationList enumerateObjectsUsingBlock:^(NSNumber *obj, NSUInteger idx, BOOL * _Nonnull stop) { 162 | if (obj.integerValue == KSApiApplication_Kwai) { 163 | str = [str stringByAppendingString:@" 快手 "]; 164 | } else if (obj.integerValue == KSApiApplication_KwaiLite) { 165 | str = [str stringByAppendingString:@" 快手极速版 "]; 166 | } 167 | }]; 168 | self.targetAppTextView.text = str; 169 | } 170 | 171 | - (IBAction)targetAppKwaiLiteTapped:(id)sender { 172 | if ([self.applicationList containsObject:@(KSApiApplication_KwaiLite)]) { 173 | [self.applicationList removeObject:@(KSApiApplication_KwaiLite)]; 174 | } else { 175 | [self.applicationList addObject:@(KSApiApplication_KwaiLite)]; 176 | } 177 | __block NSString *str = @""; 178 | [self.applicationList enumerateObjectsUsingBlock:^(NSNumber *obj, NSUInteger idx, BOOL * _Nonnull stop) { 179 | if (obj.integerValue == KSApiApplication_Kwai) { 180 | str = [str stringByAppendingString:@" 快手 "]; 181 | } else if (obj.integerValue == KSApiApplication_KwaiLite) { 182 | str = [str stringByAppendingString:@" 快手极速版 "]; 183 | } 184 | }]; 185 | self.targetAppTextView.text = str; 186 | } 187 | 188 | #pragma mark - Jumpout Style 189 | 190 | - (IBAction)jumpTypeSegmentControlValueChanged:(UISegmentedControl *)sender { 191 | //Todo 192 | } 193 | 194 | #pragma mark - AppId 195 | 196 | 197 | - (IBAction)changeAppid:(id)sender { 198 | __block UITextField *lastTextField = nil; 199 | [self showEditAlert: @"替换appId(确认后会杀掉app)" 200 | message: nil 201 | textHandler: ^(UITextField *textField) { 202 | lastTextField = textField; 203 | } cancelHandler: ^(UIAlertAction *action) { 204 | 205 | } actions: 206 | @{ 207 | @"使用textFile输入内容": ^(UIAlertAction *action) { 208 | if (lastTextField.text.length > 0) { 209 | [[KSOpenApiManager shared] saveAppId:lastTextField.text]; 210 | exit(0); 211 | } 212 | }, 213 | @"使用release-appid": ^(UIAlertAction *action) { 214 | [[KSOpenApiManager shared] saveAppId:kKSAppIdRelease]; 215 | exit(0); 216 | }, 217 | @"使用test-appid": ^(UIAlertAction *action) { 218 | [[KSOpenApiManager shared] saveAppId:kKSAppIdTest]; 219 | exit(0); 220 | } 221 | }]; 222 | } 223 | 224 | - (void)setupAppIdView { 225 | NSString *appId = [[KSOpenApiManager shared] appId]; 226 | NSString *textViewSufix; 227 | if ([appId isEqualToString:kKSAppIdTest]) { 228 | textViewSufix = @"测试环境AppId"; 229 | } else if ([appId isEqualToString:kKSAppIdRelease]) { 230 | textViewSufix = @"正式环境AppId"; 231 | } else { 232 | textViewSufix = @"自定义的AppId"; 233 | } 234 | 235 | self.appIdTextView.text = [NSString stringWithFormat:@"%@--%@",appId, textViewSufix]; 236 | } 237 | 238 | - (void)showEditAlert: (NSString *)title 239 | message: (NSString *)message 240 | textHandler: (void (^)(UITextField *textField))textHandler 241 | cancelHandler: (void (^)(UIAlertAction *action))cancelHandler 242 | actions: (NSDictionary *)actions { 243 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle: title message: message preferredStyle: UIAlertControllerStyleAlert]; 244 | if (textHandler != nil) { 245 | [alertController addTextFieldWithConfigurationHandler: textHandler]; 246 | } 247 | [actions enumerateKeysAndObjectsUsingBlock: ^(NSString * _Nonnull key, void (^ _Nonnull obj)(UIAlertAction *), BOOL * _Nonnull stop) { 248 | [alertController addAction: [UIAlertAction actionWithTitle: key style: UIAlertActionStyleDefault handler: obj]]; 249 | }]; 250 | if (cancelHandler != nil) { 251 | [alertController addAction: [UIAlertAction actionWithTitle: @"取消" style: UIAlertActionStyleCancel handler: cancelHandler]]; 252 | } 253 | [self presentViewController: alertController animated: YES completion: nil]; 254 | } 255 | 256 | #pragma mark - LogView 257 | 258 | - (void)setupLogView { 259 | [self textViewAddString:@""]; 260 | #if BETA 261 | [self textViewAddString:@"当前是BETA环境"]; 262 | #elif DEBUG 263 | [self textViewAddString:@"当前是DEBUG环境"]; 264 | #elif RELEASE 265 | [self textViewAddString:@"当前是RELEASE环境"]; 266 | #endif 267 | } 268 | 269 | - (void)textViewAddString:(NSString *)str { 270 | self.logTextView.text = [self.logTextView.text stringByAppendingString:str]; 271 | self.logTextView.text = [self.logTextView.text stringByAppendingString:@"\n------------------\n"]; 272 | } 273 | 274 | - (IBAction)cleanLogButton:(id)sender { 275 | self.logTextView.text = @""; 276 | } 277 | 278 | @end 279 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSDemoViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 39 | 47 | 55 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 97 | 106 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 131 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 154 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSMediaViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSMediaViewController.h 3 | // KSSDKShareKit 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | // NOTE: 使用相册, 需要Info.plist 添加Key:NSPhotoLibraryUsageDescription 9 | 10 | @import UIKit; 11 | 12 | @interface KSMediaViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSMediaViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSMediaViewController.m 3 | // KSSDKShareKit 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "KSMediaViewController.h" 10 | #import "CTAssetsPickerController.h" 11 | #import "KSOpenApiManager+Media.h" 12 | 13 | #define kChooseResource (100000001) 14 | #define kChooseThumbnail (100000002) 15 | 16 | @interface ExtendAssetsPickerController:CTAssetsPickerController 17 | 18 | @property (nonatomic, assign) NSInteger tag; 19 | 20 | @end 21 | 22 | @implementation ExtendAssetsPickerController 23 | 24 | @end 25 | 26 | #pragma mark - 27 | 28 | @interface KSMediaViewController () 29 | 30 | @property (nonatomic, weak) IBOutlet UILabel *currentChooseLabel; 31 | @property (nonatomic, weak) IBOutlet UILabel *tagsLabel; 32 | 33 | @property (nonatomic, weak) IBOutlet UIButton *resourceButton; 34 | @property (nonatomic, weak) IBOutlet UIButton *chooseThumbnail; 35 | @property (nonatomic, weak) IBOutlet UIButton *tagsButton; 36 | @property (nonatomic, weak) IBOutlet UIButton *shareButton; 37 | 38 | @property (nonatomic, weak) IBOutlet UISwitch *disableFallbackSwitch; 39 | @property (nonatomic, weak) IBOutlet UIButton *associateButton; 40 | 41 | @property (nonatomic, strong) KSShareMedia *shareMedia; 42 | 43 | @end 44 | 45 | @implementation KSMediaViewController 46 | 47 | - (void)viewDidLoad { 48 | [super viewDidLoad]; 49 | self.shareMedia = [[KSShareMedia alloc] init]; 50 | [self updateChooseState]; 51 | } 52 | 53 | - (IBAction)didTouchChooseFeatureStep { 54 | [self showActionSheet:@"请选择跳转页面" 55 | message:nil 56 | cancelHandler:^(UIAlertAction *action) { 57 | self.shareMedia.feature = KSShareMediaFeature_Undefine; 58 | [self updateChooseState]; 59 | } actions: 60 | @{ 61 | @"图片编辑页":^(UIAlertAction *action) { 62 | self.shareMedia.feature = KSShareMediaFeature_PictureEdit; 63 | [self updateChooseState]; 64 | }, 65 | @"单视频编辑页":^(UIAlertAction *action) { 66 | self.shareMedia.feature = KSShareMediaFeature_VideoEdit; 67 | [self updateChooseState]; 68 | }, 69 | @"裁剪页(支持多视频)":^(UIAlertAction *action) { 70 | self.shareMedia.feature = KSShareMediaFeature_Preprocess; 71 | [self updateChooseState]; 72 | }, 73 | @"单视频发布页":^(UIAlertAction *action) { 74 | self.shareMedia.feature = KSShareMediaFeature_VideoPublish; 75 | [self updateChooseState]; 76 | }, 77 | @"智能剪裁":^(UIAlertAction *action) { 78 | self.shareMedia.feature = KSShareMediaFeature_AICut; 79 | [self updateChooseState]; 80 | }, 81 | }]; 82 | } 83 | 84 | - (IBAction)didTouchChooseResourceStep { 85 | // 判断是否支持当前类型分享 86 | if (![KSApi isAppInstalledFor:KSApiApplication_Kwai]) { 87 | [self showAlert:@"提示" 88 | message:@"未安装快手" 89 | cancelHandler:^(UIAlertAction *action) { 90 | } actions:nil]; 91 | return; 92 | } 93 | 94 | __weak __typeof(self) ws = self; 95 | [self showActionSheet:@"请选择获取素材方式" 96 | message:nil 97 | cancelHandler:^(UIAlertAction *action) { 98 | } actions:@{ 99 | @"相册":^(UIAlertAction *action) { 100 | __strong __typeof(ws) ss = ws; 101 | ExtendAssetsPickerController *browser = [[ExtendAssetsPickerController alloc] init]; 102 | browser.tag = kChooseResource; 103 | browser.delegate = ss; 104 | [ss presentViewController:browser animated:YES completion:nil]; 105 | } 106 | }]; 107 | 108 | CTAssetsPickerController *browser = [[CTAssetsPickerController alloc] init]; 109 | browser.delegate = self; 110 | browser.showsSelectionIndex = YES; 111 | [self presentViewController:browser animated:YES completion:nil]; 112 | } 113 | 114 | - (IBAction)didTouchChooseThumbnail:(id)sender { 115 | __weak __typeof(self) ws = self; 116 | [self showActionSheet:@"请选择获取封面的方式" 117 | message:nil 118 | cancelHandler:^(UIAlertAction *action) { 119 | } actions:@{ 120 | @"相册":^(UIAlertAction *action) { 121 | __strong __typeof(ws) ss = ws; 122 | ExtendAssetsPickerController *browser = [[ExtendAssetsPickerController alloc] init]; 123 | browser.tag = kChooseThumbnail; 124 | browser.delegate = ss; 125 | [ss presentViewController:browser animated:YES completion:nil]; 126 | } 127 | }]; 128 | 129 | CTAssetsPickerController *browser = [[CTAssetsPickerController alloc] init]; 130 | browser.delegate = self; 131 | browser.showsSelectionIndex = YES; 132 | [self presentViewController:browser animated:YES completion:nil]; 133 | } 134 | 135 | - (IBAction)didTouchManageTagsStep { 136 | __weak __typeof(self) ws = self; 137 | __block UITextField *lastTextField = nil; 138 | void (^addBlock)(UIAlertAction *action) = ^(UIAlertAction *action) { 139 | __strong __typeof(ws) ss = ws; 140 | [ss showEditAlert:@"添加标签" 141 | message:nil 142 | firstTextHandler:^(UITextField *textField) { 143 | lastTextField = textField; 144 | } secondTextHandler:nil 145 | cancelHandler:^(UIAlertAction *action) { 146 | } actions:@{ 147 | @"添加":^(UIAlertAction *action) { 148 | __strong __typeof(ws) ss = ws; 149 | if (lastTextField.text.length > 0) { 150 | [ss.shareMedia.tags addObject:lastTextField.text]; 151 | [ss updateChooseState]; 152 | } 153 | }, 154 | }]; 155 | }; 156 | 157 | void (^cleanBlock)(UIAlertAction *action) = ^(UIAlertAction *action) { 158 | __strong __typeof(ws) ss = ws; 159 | [ss.shareMedia.tags removeAllObjects]; 160 | [ss updateChooseState]; 161 | }; 162 | 163 | [self showActionSheet:@"编辑标签" 164 | message:nil 165 | cancelHandler:^(UIAlertAction *action) { 166 | } actions:@{ 167 | @"添加":addBlock, 168 | @"清空":cleanBlock 169 | }]; 170 | } 171 | 172 | - (IBAction)dismissSelf:(id)sender { 173 | [self dismissViewControllerAnimated:YES completion:nil]; 174 | } 175 | 176 | - (IBAction)didTouchManageExtraInfoStep { 177 | __weak __typeof(self) ws = self; 178 | void (^editBlock)(UIAlertAction *action) = ^(UIAlertAction *action) { 179 | __strong __typeof(ws) ss = ws; 180 | __block UITextField *lastKeyTextField = nil; 181 | __block UITextField *lastValueTextField = nil; 182 | [ss showEditAlert:@"编辑ExtraInfo" 183 | message:nil 184 | firstTextHandler:^(UITextField *textField) { 185 | lastKeyTextField = textField; 186 | } 187 | secondTextHandler:^(UITextField *textField) { 188 | lastValueTextField = textField; 189 | } cancelHandler:^(UIAlertAction *action) { 190 | } actions:@{ 191 | @"修改":^(UIAlertAction *action) { 192 | __strong __typeof(ws) ss = ws; 193 | if (!ss.shareMedia.extraEntity) { 194 | ss.shareMedia.extraEntity = [NSMutableDictionary dictionary]; 195 | } 196 | ss.shareMedia.extraEntity[lastKeyTextField.text] = lastValueTextField.text; 197 | }, 198 | }]; 199 | }; 200 | void (^cleanBlock)(UIAlertAction *action) = ^(UIAlertAction *action) { 201 | __strong __typeof(ws) ss = ws; 202 | ss.shareMedia.extraEntity = [NSMutableDictionary dictionary]; 203 | }; 204 | 205 | [self showActionSheet:@"编辑ExtraInfo" 206 | message:[NSString stringWithFormat:@"%@", self.shareMedia.extraEntity] 207 | cancelHandler:^(UIAlertAction *action) { 208 | } actions:@{ 209 | @"编辑":editBlock, 210 | @"清空": cleanBlock, 211 | }]; 212 | } 213 | 214 | - (IBAction)didTouchAddAssociateInfo:(id)sender { 215 | 216 | __block UITextField *titleTF; 217 | __block UITextField *appIdTF; 218 | __block UITextField *pathTF; 219 | __weak __typeof(self) ws = self; 220 | [self showEditAlert:@"添加关联信息" message:nil configHandlers:@[ 221 | ^ (UITextField *textField) 222 | { 223 | textField.placeholder = @"title"; 224 | titleTF = textField; 225 | }, 226 | ^ (UITextField *textField) 227 | { 228 | textField.placeholder = @"appId"; 229 | appIdTF = textField; 230 | }, 231 | ^ (UITextField *textField) 232 | { 233 | textField.placeholder = @"path"; 234 | pathTF = textField; 235 | }, 236 | ] cancelHandler:^(UIAlertAction *action) { 237 | 238 | 239 | } actions:@{ 240 | @"确认":^(UIAlertAction *action) { 241 | __strong __typeof(ws) ss = ws; 242 | KSMediaAssociateKWAppObject *object = [[KSMediaAssociateKWAppObject alloc] init]; 243 | object.title = titleTF.text; 244 | object.kWAppId = appIdTF.text; 245 | object.kWAppPath = pathTF.text; 246 | ss.shareMedia.associateType = KSMediaAssociateKWApp; 247 | ss.shareMedia.associateObject = object; 248 | }, 249 | }]; 250 | } 251 | 252 | - (IBAction)didTouchShareStep { 253 | __weak __typeof(self) ws = self; 254 | self.shareMedia.disableFallback = self.disableFallbackSwitch.isOn; 255 | 256 | [self.shareMedia share:^(BOOL success) { 257 | __strong __typeof(ws) ss = ws; 258 | if (!success) { 259 | [ss showAlert:@"提示" message:@"调用分享失败" cancelHandler:^(UIAlertAction *action) { 260 | } actions:nil]; 261 | } else { 262 | [ss dismissViewControllerAnimated:YES completion:nil]; 263 | } 264 | }]; 265 | } 266 | 267 | #pragma mark - CTAssetsPickerControllerDelegate 268 | 269 | - (void)assetsPickerController:(CTAssetsPickerController *)picker didFinishPickingAssets:(NSArray *)assets { 270 | void(^warningBlock)(NSString *message) = ^(NSString *message) { 271 | [self showAlertController:picker 272 | title:@"警告" 273 | message:message 274 | preferredStyle:UIAlertControllerStyleAlert 275 | cancelTitle:@"知道了" 276 | cancelHandler:^(UIAlertAction *action) { 277 | } actions:nil]; 278 | }; 279 | NSInteger tag = kChooseResource; 280 | if ([picker isKindOfClass:ExtendAssetsPickerController.class]) { 281 | tag = ((ExtendAssetsPickerController *) picker).tag; 282 | } 283 | 284 | if (tag == kChooseResource) { 285 | self.shareMedia.assets = assets; 286 | } else if (tag == kChooseThumbnail) { 287 | if (assets.count > 1 || assets.firstObject.mediaType != PHAssetMediaTypeImage) { 288 | warningBlock(@"请选择单张缩略图"); 289 | return; 290 | } 291 | self.shareMedia.thumbnail = assets.firstObject; 292 | } 293 | [self updateChooseState]; 294 | [picker dismissViewControllerAnimated:YES completion:nil]; 295 | } 296 | 297 | #pragma mark - private 298 | 299 | - (void)updateChooseState { 300 | NSMutableString *currentChoose = [NSMutableString string]; 301 | if (self.shareMedia.assets.count > 0) { 302 | if (self.shareMedia.assets.count == 1 && ![self.shareMedia firstAssetIsImage]) { 303 | [currentChoose appendString:@"选择了一个视频"]; 304 | if (self.shareMedia.thumbnail != nil) { 305 | [currentChoose appendString:@"[封面]"]; 306 | } 307 | } else if (self.shareMedia.assets.count > 1) { 308 | [currentChoose appendString:[NSString stringWithFormat:@"选择了%ld个资源", (long)self.shareMedia.assets.count]]; 309 | } else if (self.shareMedia.assets.count == 1 && [self.shareMedia firstAssetIsImage]) { 310 | [currentChoose appendString:@"选择了一个图片"]; 311 | } 312 | } else { 313 | if (self.shareMedia.feature == KSShareMediaFeature_Preprocess) { 314 | [currentChoose appendString:@"选择 [多段视频/图片]"]; 315 | } 316 | } 317 | if (self.shareMedia.feature == KSShareMediaFeature_Preprocess) { 318 | [currentChoose appendString:@" 分享到 [裁剪页]"]; 319 | } 320 | if (self.shareMedia.feature == KSShareMediaFeature_Undefine) { 321 | self.resourceButton.enabled = NO; 322 | self.shareButton.enabled = NO; 323 | self.chooseThumbnail.enabled = NO; 324 | } else { 325 | self.resourceButton.enabled = YES; 326 | self.shareButton.enabled = YES; 327 | self.chooseThumbnail.enabled = NO; 328 | if (self.shareMedia.assets.count > 0) { 329 | self.chooseThumbnail.enabled = YES; 330 | } 331 | } 332 | if (self.shareMedia.tags.count > 0) { 333 | self.tagsLabel.text = [self.shareMedia.tags componentsJoinedByString:@"#"]; 334 | } else { 335 | self.tagsLabel.text = @""; 336 | } 337 | if (currentChoose.length <= 0) { 338 | self.currentChooseLabel.text = @"请选择分享参数"; 339 | } else { 340 | self.currentChooseLabel.text = currentChoose; 341 | } 342 | } 343 | 344 | - (void)showActionSheet:(NSString *)title 345 | message:(NSString *)message 346 | cancelHandler:(void (^)(UIAlertAction *action))cancelHandler 347 | actions:(NSDictionary *)actions { 348 | [self showAlertController:self title:title message:message preferredStyle:UIAlertControllerStyleActionSheet cancelTitle:@"取消" cancelHandler:cancelHandler actions:actions]; 349 | } 350 | 351 | - (void)showAlert:(NSString *)title 352 | message:(NSString *)message 353 | cancelHandler:(void (^)(UIAlertAction *action))cancelHandler 354 | actions:(NSDictionary *)actions { 355 | [self showAlertController:self title:title message:message preferredStyle:UIAlertControllerStyleAlert cancelTitle:@"知道了" cancelHandler:cancelHandler actions:actions]; 356 | } 357 | 358 | - (void)showEditAlert:(NSString *)title 359 | message:(NSString *)message 360 | firstTextHandler:(void (^)(UITextField *textField))firstTextHandler 361 | secondTextHandler:(void (^)(UITextField *textField))secondTextHandler 362 | cancelHandler:(void (^)(UIAlertAction *action))cancelHandler 363 | actions:(NSDictionary *)actions { 364 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; 365 | if (firstTextHandler) { 366 | [alertController addTextFieldWithConfigurationHandler:firstTextHandler]; 367 | } 368 | if (secondTextHandler) { 369 | [alertController addTextFieldWithConfigurationHandler:secondTextHandler]; 370 | } 371 | [actions enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, void (^ _Nonnull obj)(UIAlertAction *), BOOL * _Nonnull stop) { 372 | [alertController addAction:[UIAlertAction actionWithTitle:key style:UIAlertActionStyleDefault handler:obj]]; 373 | }]; 374 | if (cancelHandler != nil) { 375 | [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:cancelHandler]]; 376 | } 377 | [self presentViewController:alertController animated:YES completion:nil]; 378 | } 379 | 380 | - (void)showEditAlert:(NSString *)title 381 | message:(NSString *)message 382 | configHandlers:(NSArray *)configHandlers 383 | cancelHandler:(void (^)(UIAlertAction *action))cancelHandler 384 | actions:(NSDictionary *)actions { 385 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; 386 | 387 | [configHandlers enumerateObjectsUsingBlock:^(void (^ _Nonnull obj)(UITextField *), NSUInteger idx, BOOL * _Nonnull stop) { 388 | [alertController addTextFieldWithConfigurationHandler:obj]; 389 | }]; 390 | 391 | [actions enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, void (^ _Nonnull obj)(UIAlertAction *), BOOL * _Nonnull stop) { 392 | [alertController addAction:[UIAlertAction actionWithTitle:key style:UIAlertActionStyleDefault handler:obj]]; 393 | }]; 394 | 395 | if (cancelHandler != nil) { 396 | [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:cancelHandler]]; 397 | } 398 | [self presentViewController:alertController animated:YES completion:nil]; 399 | } 400 | 401 | - (void)showAlertController:(UIViewController *)controller 402 | title:(NSString *)title 403 | message:(NSString *)message 404 | preferredStyle:(UIAlertControllerStyle)preferredStyle 405 | cancelTitle:(NSString *)cancelTitle 406 | cancelHandler:(void (^)(UIAlertAction *action))cancelHandler 407 | actions:(NSDictionary *)actions { 408 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:preferredStyle]; 409 | [actions enumerateKeysAndObjectsUsingBlock: 410 | ^(NSString * _Nonnull key, void (^ _Nonnull obj)(UIAlertAction *), BOOL * _Nonnull stop) { 411 | [alertController addAction:[UIAlertAction actionWithTitle:key style:UIAlertActionStyleDefault handler:obj]]; 412 | }]; 413 | if (cancelHandler != nil) { 414 | [alertController addAction:[UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleCancel handler:cancelHandler]]; 415 | } 416 | [controller presentViewController:alertController animated:YES completion:nil]; 417 | } 418 | 419 | @end 420 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSShareMessageViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSShareMessageViewController.h 3 | // KwaiSDK_Example 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface KSShareMessageViewController : UIViewController 14 | 15 | @property (nonatomic, copy) NSString *receiverOpenId; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSShareMessageViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // KSShareMessageViewController.m 3 | // KwaiSDK_Example 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import "KSShareMessageViewController.h" 10 | #import "KSOpenApiManager+Message.h" 11 | 12 | 13 | @interface KSShareMessageViewController () 14 | 15 | @property (strong, nonatomic) IBOutlet UITextView *titleTextView; 16 | @property (strong, nonatomic) IBOutlet UITextView *descTextView; 17 | @property (strong, nonatomic) IBOutlet UITextView *linkTextView; 18 | @property (strong, nonatomic) IBOutlet UILabel *imageLabel; 19 | 20 | @property (nonatomic, strong) NSData *imageData; 21 | 22 | @end 23 | 24 | @implementation KSShareMessageViewController 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(endEditing)]; 30 | [self.view addGestureRecognizer:tgr]; 31 | } 32 | 33 | - (void)endEditing { 34 | [self.titleTextView resignFirstResponder]; 35 | [self.descTextView resignFirstResponder]; 36 | [self.linkTextView resignFirstResponder]; 37 | } 38 | 39 | - (IBAction)done:(id)sender { 40 | [[KSOpenApiManager shared] shareMesssageTo:self.receiverOpenId 41 | title: self.titleTextView.text 42 | desc:self.descTextView.text 43 | link:self.linkTextView.text 44 | thumbImage:self.imageData 45 | extraInfo:@{}]; 46 | [self dismissViewControllerAnimated:YES completion:NULL]; 47 | } 48 | 49 | - (IBAction)selectImage:(id)sender { 50 | UIImagePickerController *pickerLibrary = [[UIImagePickerController alloc] init]; 51 | pickerLibrary.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 52 | pickerLibrary.delegate = self; 53 | [self presentViewController:pickerLibrary 54 | animated:YES 55 | completion:NULL]; 56 | } 57 | 58 | - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 59 | UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage]; 60 | self.imageLabel.numberOfLines = 0; 61 | self.imageData = UIImageJPEGRepresentation(image, 1); 62 | self.imageLabel.text = [NSString stringWithFormat:@"select image (%@ x %@), data length %.1fk", @(image.size.width),@(image.size.height 63 | ), self.imageData.length / 1024.0]; 64 | [picker dismissViewControllerAnimated:YES completion:NULL]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KSShareMessageViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 40 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 78 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KwaiOpenSDKDemo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.associated-domains 6 | 7 | applinks:your.app.com 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KwaiOpenSDKDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6BAF8977BABB844C677EBD27 /* Pods_KwaiOpenSDKDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B42BB06A4F16042C13CFCDA /* Pods_KwaiOpenSDKDemo.framework */; }; 11 | BB81F05828892AAB003C22B6 /* KSOpenApiManager+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = BB81F05728892AAB003C22B6 /* KSOpenApiManager+Utils.m */; }; 12 | BBADB1D2288002D1006F7869 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB1D1288002D1006F7869 /* AppDelegate.m */; }; 13 | BBADB1D8288002D1006F7869 /* KSDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB1D7288002D1006F7869 /* KSDemoViewController.m */; }; 14 | BBADB1DB288002D1006F7869 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BBADB1D9288002D1006F7869 /* Main.storyboard */; }; 15 | BBADB1DD288002D3006F7869 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BBADB1DC288002D3006F7869 /* Assets.xcassets */; }; 16 | BBADB1E0288002D3006F7869 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BBADB1DE288002D3006F7869 /* LaunchScreen.storyboard */; }; 17 | BBADB1E3288002D3006F7869 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB1E2288002D3006F7869 /* main.m */; }; 18 | BBADB2C128801823006F7869 /* KSOpenApiManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2C028801823006F7869 /* KSOpenApiManager.m */; }; 19 | BBADB2C428801AC0006F7869 /* KSOpenApiManager+Auth.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2C328801AC0006F7869 /* KSOpenApiManager+Auth.m */; }; 20 | BBADB2CA28801B23006F7869 /* KSOpenApiManager+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2C928801B23006F7869 /* KSOpenApiManager+Message.m */; }; 21 | BBADB2CD28801B3B006F7869 /* KSOpenApiManager+Media.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2CC28801B3B006F7869 /* KSOpenApiManager+Media.m */; }; 22 | BBADB2D028801B4F006F7869 /* KSOpenApiManager+Profile.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2CF28801B4F006F7869 /* KSOpenApiManager+Profile.m */; }; 23 | BBADB2D328801D3A006F7869 /* KSShareMessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2D128801D3A006F7869 /* KSShareMessageViewController.m */; }; 24 | BBADB2D8288030D1006F7869 /* KSMediaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BBADB2D6288030D1006F7869 /* KSMediaViewController.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 9B42BB06A4F16042C13CFCDA /* Pods_KwaiOpenSDKDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KwaiOpenSDKDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | AF1390DF373C0C0298E43A9B /* Pods-KwaiOpenSDKDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KwaiOpenSDKDemo.debug.xcconfig"; path = "Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo.debug.xcconfig"; sourceTree = ""; }; 30 | BB81F05628892AAB003C22B6 /* KSOpenApiManager+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Utils.h"; sourceTree = ""; }; 31 | BB81F05728892AAB003C22B6 /* KSOpenApiManager+Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Utils.m"; sourceTree = ""; }; 32 | BBADB1CD288002D1006F7869 /* KwaiOpenSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KwaiOpenSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | BBADB1D0288002D1006F7869 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 34 | BBADB1D1288002D1006F7869 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 35 | BBADB1D6288002D1006F7869 /* KSDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSDemoViewController.h; sourceTree = ""; }; 36 | BBADB1D7288002D1006F7869 /* KSDemoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSDemoViewController.m; sourceTree = ""; }; 37 | BBADB1DA288002D1006F7869 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | BBADB1DC288002D3006F7869 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 39 | BBADB1DF288002D3006F7869 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 40 | BBADB1E1288002D3006F7869 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | BBADB1E2288002D3006F7869 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | BBADB2BD28801153006F7869 /* KwaiOpenSDKDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = KwaiOpenSDKDemo.entitlements; sourceTree = ""; }; 43 | BBADB2C028801823006F7869 /* KSOpenApiManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSOpenApiManager.m; sourceTree = ""; }; 44 | BBADB2C228801AC0006F7869 /* KSOpenApiManager+Auth.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Auth.h"; sourceTree = ""; }; 45 | BBADB2C328801AC0006F7869 /* KSOpenApiManager+Auth.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Auth.m"; sourceTree = ""; }; 46 | BBADB2C528801AF9006F7869 /* KSOpenApiManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSOpenApiManager.h; sourceTree = ""; }; 47 | BBADB2C828801B23006F7869 /* KSOpenApiManager+Message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Message.h"; sourceTree = ""; }; 48 | BBADB2C928801B23006F7869 /* KSOpenApiManager+Message.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Message.m"; sourceTree = ""; }; 49 | BBADB2CB28801B3B006F7869 /* KSOpenApiManager+Media.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Media.h"; sourceTree = ""; }; 50 | BBADB2CC28801B3B006F7869 /* KSOpenApiManager+Media.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Media.m"; sourceTree = ""; }; 51 | BBADB2CE28801B4F006F7869 /* KSOpenApiManager+Profile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KSOpenApiManager+Profile.h"; sourceTree = ""; }; 52 | BBADB2CF28801B4F006F7869 /* KSOpenApiManager+Profile.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "KSOpenApiManager+Profile.m"; sourceTree = ""; }; 53 | BBADB2D128801D3A006F7869 /* KSShareMessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSShareMessageViewController.m; sourceTree = ""; }; 54 | BBADB2D228801D3A006F7869 /* KSShareMessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSShareMessageViewController.h; sourceTree = ""; }; 55 | BBADB2D6288030D1006F7869 /* KSMediaViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSMediaViewController.m; sourceTree = ""; }; 56 | BBADB2D7288030D1006F7869 /* KSMediaViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSMediaViewController.h; sourceTree = ""; }; 57 | D562A8D44B40E802F0C97D93 /* Pods-KwaiOpenSDKDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KwaiOpenSDKDemo.release.xcconfig"; path = "Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo.release.xcconfig"; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | BBADB1CA288002D1006F7869 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 6BAF8977BABB844C677EBD27 /* Pods_KwaiOpenSDKDemo.framework in Frameworks */, 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | /* End PBXFrameworksBuildPhase section */ 70 | 71 | /* Begin PBXGroup section */ 72 | 0894DA9AF7B12A686C29773B /* Frameworks */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 9B42BB06A4F16042C13CFCDA /* Pods_KwaiOpenSDKDemo.framework */, 76 | ); 77 | name = Frameworks; 78 | sourceTree = ""; 79 | }; 80 | 149C0616F01FCD6133684DB0 /* Pods */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | AF1390DF373C0C0298E43A9B /* Pods-KwaiOpenSDKDemo.debug.xcconfig */, 84 | D562A8D44B40E802F0C97D93 /* Pods-KwaiOpenSDKDemo.release.xcconfig */, 85 | ); 86 | path = Pods; 87 | sourceTree = ""; 88 | }; 89 | BBADB1C4288002D1006F7869 = { 90 | isa = PBXGroup; 91 | children = ( 92 | BBADB1CF288002D1006F7869 /* KwaiOpenSDKDemo */, 93 | BBADB1CE288002D1006F7869 /* Products */, 94 | 149C0616F01FCD6133684DB0 /* Pods */, 95 | 0894DA9AF7B12A686C29773B /* Frameworks */, 96 | ); 97 | sourceTree = ""; 98 | }; 99 | BBADB1CE288002D1006F7869 /* Products */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | BBADB1CD288002D1006F7869 /* KwaiOpenSDKDemo.app */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | BBADB1CF288002D1006F7869 /* KwaiOpenSDKDemo */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | BBADB2BE28801823006F7869 /* KSOpenApiManager */, 111 | BBADB2BD28801153006F7869 /* KwaiOpenSDKDemo.entitlements */, 112 | BBADB1D0288002D1006F7869 /* AppDelegate.h */, 113 | BBADB1D1288002D1006F7869 /* AppDelegate.m */, 114 | BBADB1D6288002D1006F7869 /* KSDemoViewController.h */, 115 | BBADB1D7288002D1006F7869 /* KSDemoViewController.m */, 116 | BBADB2D228801D3A006F7869 /* KSShareMessageViewController.h */, 117 | BBADB2D128801D3A006F7869 /* KSShareMessageViewController.m */, 118 | BBADB2D7288030D1006F7869 /* KSMediaViewController.h */, 119 | BBADB2D6288030D1006F7869 /* KSMediaViewController.m */, 120 | BBADB1D9288002D1006F7869 /* Main.storyboard */, 121 | BBADB1DC288002D3006F7869 /* Assets.xcassets */, 122 | BBADB1DE288002D3006F7869 /* LaunchScreen.storyboard */, 123 | BBADB1E1288002D3006F7869 /* Info.plist */, 124 | BBADB1E2288002D3006F7869 /* main.m */, 125 | ); 126 | path = KwaiOpenSDKDemo; 127 | sourceTree = ""; 128 | }; 129 | BBADB2BE28801823006F7869 /* KSOpenApiManager */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | BBADB2C528801AF9006F7869 /* KSOpenApiManager.h */, 133 | BBADB2C028801823006F7869 /* KSOpenApiManager.m */, 134 | BB81F05628892AAB003C22B6 /* KSOpenApiManager+Utils.h */, 135 | BB81F05728892AAB003C22B6 /* KSOpenApiManager+Utils.m */, 136 | BBADB2C228801AC0006F7869 /* KSOpenApiManager+Auth.h */, 137 | BBADB2C328801AC0006F7869 /* KSOpenApiManager+Auth.m */, 138 | BBADB2CE28801B4F006F7869 /* KSOpenApiManager+Profile.h */, 139 | BBADB2CF28801B4F006F7869 /* KSOpenApiManager+Profile.m */, 140 | BBADB2C828801B23006F7869 /* KSOpenApiManager+Message.h */, 141 | BBADB2C928801B23006F7869 /* KSOpenApiManager+Message.m */, 142 | BBADB2CB28801B3B006F7869 /* KSOpenApiManager+Media.h */, 143 | BBADB2CC28801B3B006F7869 /* KSOpenApiManager+Media.m */, 144 | ); 145 | path = KSOpenApiManager; 146 | sourceTree = SOURCE_ROOT; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | BBADB1CC288002D1006F7869 /* KwaiOpenSDKDemo */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = BBADB1E6288002D3006F7869 /* Build configuration list for PBXNativeTarget "KwaiOpenSDKDemo" */; 154 | buildPhases = ( 155 | 069014D784A4CDC571541AEF /* [CP] Check Pods Manifest.lock */, 156 | BBADB1C9288002D1006F7869 /* Sources */, 157 | BBADB1CA288002D1006F7869 /* Frameworks */, 158 | BBADB1CB288002D1006F7869 /* Resources */, 159 | C07AA444397ACACF2F25C2FE /* [CP] Embed Pods Frameworks */, 160 | ); 161 | buildRules = ( 162 | ); 163 | dependencies = ( 164 | ); 165 | name = KwaiOpenSDKDemo; 166 | productName = KwaiOpenSDKDemo; 167 | productReference = BBADB1CD288002D1006F7869 /* KwaiOpenSDKDemo.app */; 168 | productType = "com.apple.product-type.application"; 169 | }; 170 | /* End PBXNativeTarget section */ 171 | 172 | /* Begin PBXProject section */ 173 | BBADB1C5288002D1006F7869 /* Project object */ = { 174 | isa = PBXProject; 175 | attributes = { 176 | BuildIndependentTargetsInParallel = 1; 177 | LastUpgradeCheck = 1320; 178 | TargetAttributes = { 179 | BBADB1CC288002D1006F7869 = { 180 | CreatedOnToolsVersion = 13.2.1; 181 | }; 182 | }; 183 | }; 184 | buildConfigurationList = BBADB1C8288002D1006F7869 /* Build configuration list for PBXProject "KwaiOpenSDKDemo" */; 185 | compatibilityVersion = "Xcode 13.0"; 186 | developmentRegion = en; 187 | hasScannedForEncodings = 0; 188 | knownRegions = ( 189 | en, 190 | Base, 191 | ); 192 | mainGroup = BBADB1C4288002D1006F7869; 193 | productRefGroup = BBADB1CE288002D1006F7869 /* Products */; 194 | projectDirPath = ""; 195 | projectRoot = ""; 196 | targets = ( 197 | BBADB1CC288002D1006F7869 /* KwaiOpenSDKDemo */, 198 | ); 199 | }; 200 | /* End PBXProject section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | BBADB1CB288002D1006F7869 /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | BBADB1E0288002D3006F7869 /* LaunchScreen.storyboard in Resources */, 208 | BBADB1DD288002D3006F7869 /* Assets.xcassets in Resources */, 209 | BBADB1DB288002D1006F7869 /* Main.storyboard in Resources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXResourcesBuildPhase section */ 214 | 215 | /* Begin PBXShellScriptBuildPhase section */ 216 | 069014D784A4CDC571541AEF /* [CP] Check Pods Manifest.lock */ = { 217 | isa = PBXShellScriptBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | ); 221 | inputFileListPaths = ( 222 | ); 223 | inputPaths = ( 224 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 225 | "${PODS_ROOT}/Manifest.lock", 226 | ); 227 | name = "[CP] Check Pods Manifest.lock"; 228 | outputFileListPaths = ( 229 | ); 230 | outputPaths = ( 231 | "$(DERIVED_FILE_DIR)/Pods-KwaiOpenSDKDemo-checkManifestLockResult.txt", 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | shellPath = /bin/sh; 235 | 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"; 236 | showEnvVarsInLog = 0; 237 | }; 238 | C07AA444397ACACF2F25C2FE /* [CP] Embed Pods Frameworks */ = { 239 | isa = PBXShellScriptBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | ); 243 | inputFileListPaths = ( 244 | "${PODS_ROOT}/Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist", 245 | ); 246 | name = "[CP] Embed Pods Frameworks"; 247 | outputFileListPaths = ( 248 | "${PODS_ROOT}/Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist", 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | shellPath = /bin/sh; 252 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-KwaiOpenSDKDemo/Pods-KwaiOpenSDKDemo-frameworks.sh\"\n"; 253 | showEnvVarsInLog = 0; 254 | }; 255 | /* End PBXShellScriptBuildPhase section */ 256 | 257 | /* Begin PBXSourcesBuildPhase section */ 258 | BBADB1C9288002D1006F7869 /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | BBADB2CA28801B23006F7869 /* KSOpenApiManager+Message.m in Sources */, 263 | BBADB1D8288002D1006F7869 /* KSDemoViewController.m in Sources */, 264 | BBADB2C128801823006F7869 /* KSOpenApiManager.m in Sources */, 265 | BBADB2C428801AC0006F7869 /* KSOpenApiManager+Auth.m in Sources */, 266 | BBADB2D328801D3A006F7869 /* KSShareMessageViewController.m in Sources */, 267 | BBADB1D2288002D1006F7869 /* AppDelegate.m in Sources */, 268 | BBADB2CD28801B3B006F7869 /* KSOpenApiManager+Media.m in Sources */, 269 | BBADB2D8288030D1006F7869 /* KSMediaViewController.m in Sources */, 270 | BBADB1E3288002D3006F7869 /* main.m in Sources */, 271 | BBADB2D028801B4F006F7869 /* KSOpenApiManager+Profile.m in Sources */, 272 | BB81F05828892AAB003C22B6 /* KSOpenApiManager+Utils.m in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | /* End PBXSourcesBuildPhase section */ 277 | 278 | /* Begin PBXVariantGroup section */ 279 | BBADB1D9288002D1006F7869 /* Main.storyboard */ = { 280 | isa = PBXVariantGroup; 281 | children = ( 282 | BBADB1DA288002D1006F7869 /* Base */, 283 | ); 284 | name = Main.storyboard; 285 | sourceTree = ""; 286 | }; 287 | BBADB1DE288002D3006F7869 /* LaunchScreen.storyboard */ = { 288 | isa = PBXVariantGroup; 289 | children = ( 290 | BBADB1DF288002D3006F7869 /* Base */, 291 | ); 292 | name = LaunchScreen.storyboard; 293 | sourceTree = ""; 294 | }; 295 | /* End PBXVariantGroup section */ 296 | 297 | /* Begin XCBuildConfiguration section */ 298 | BBADB1E4288002D3006F7869 /* Debug */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_ANALYZER_NONNULL = YES; 303 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_ENABLE_OBJC_WEAK = YES; 309 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 310 | CLANG_WARN_BOOL_CONVERSION = YES; 311 | CLANG_WARN_COMMA = YES; 312 | CLANG_WARN_CONSTANT_CONVERSION = YES; 313 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INFINITE_RECURSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 322 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu11; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 15.2; 350 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 351 | MTL_FAST_MATH = YES; 352 | ONLY_ACTIVE_ARCH = YES; 353 | SDKROOT = iphoneos; 354 | }; 355 | name = Debug; 356 | }; 357 | BBADB1E5288002D3006F7869 /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_ANALYZER_NONNULL = YES; 362 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 363 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 364 | CLANG_CXX_LIBRARY = "libc++"; 365 | CLANG_ENABLE_MODULES = YES; 366 | CLANG_ENABLE_OBJC_ARC = YES; 367 | CLANG_ENABLE_OBJC_WEAK = YES; 368 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 369 | CLANG_WARN_BOOL_CONVERSION = YES; 370 | CLANG_WARN_COMMA = YES; 371 | CLANG_WARN_CONSTANT_CONVERSION = YES; 372 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 374 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 375 | CLANG_WARN_EMPTY_BODY = YES; 376 | CLANG_WARN_ENUM_CONVERSION = YES; 377 | CLANG_WARN_INFINITE_RECURSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 380 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 381 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 383 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 384 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 385 | CLANG_WARN_STRICT_PROTOTYPES = YES; 386 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 387 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 388 | CLANG_WARN_UNREACHABLE_CODE = YES; 389 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 390 | COPY_PHASE_STRIP = NO; 391 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 392 | ENABLE_NS_ASSERTIONS = NO; 393 | ENABLE_STRICT_OBJC_MSGSEND = YES; 394 | GCC_C_LANGUAGE_STANDARD = gnu11; 395 | GCC_NO_COMMON_BLOCKS = YES; 396 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 397 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 398 | GCC_WARN_UNDECLARED_SELECTOR = YES; 399 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 400 | GCC_WARN_UNUSED_FUNCTION = YES; 401 | GCC_WARN_UNUSED_VARIABLE = YES; 402 | IPHONEOS_DEPLOYMENT_TARGET = 15.2; 403 | MTL_ENABLE_DEBUG_INFO = NO; 404 | MTL_FAST_MATH = YES; 405 | SDKROOT = iphoneos; 406 | VALIDATE_PRODUCT = YES; 407 | }; 408 | name = Release; 409 | }; 410 | BBADB1E7288002D3006F7869 /* Debug */ = { 411 | isa = XCBuildConfiguration; 412 | baseConfigurationReference = AF1390DF373C0C0298E43A9B /* Pods-KwaiOpenSDKDemo.debug.xcconfig */; 413 | buildSettings = { 414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 415 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 416 | CODE_SIGN_ENTITLEMENTS = KwaiOpenSDKDemo/KwaiOpenSDKDemo.entitlements; 417 | CODE_SIGN_IDENTITY = "iPhone Developer"; 418 | CODE_SIGN_STYLE = Manual; 419 | CURRENT_PROJECT_VERSION = 1; 420 | DEVELOPMENT_TEAM = 36APS3J9VX; 421 | GENERATE_INFOPLIST_FILE = YES; 422 | INFOPLIST_FILE = KwaiOpenSDKDemo/Info.plist; 423 | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Photo Library Access Warning"; 424 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 425 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 426 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 427 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 428 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 429 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 430 | LD_RUNPATH_SEARCH_PATHS = ( 431 | "$(inherited)", 432 | "@executable_path/Frameworks", 433 | ); 434 | MARKETING_VERSION = 1.0; 435 | PRODUCT_BUNDLE_IDENTIFIER = com.jiangjia.kwai.kwappsdk; 436 | PRODUCT_NAME = "$(TARGET_NAME)"; 437 | PROVISIONING_PROFILE_SPECIFIER = "kwappsdk-dev"; 438 | SWIFT_EMIT_LOC_STRINGS = YES; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | }; 441 | name = Debug; 442 | }; 443 | BBADB1E8288002D3006F7869 /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = D562A8D44B40E802F0C97D93 /* Pods-KwaiOpenSDKDemo.release.xcconfig */; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 449 | CODE_SIGN_ENTITLEMENTS = KwaiOpenSDKDemo/KwaiOpenSDKDemo.entitlements; 450 | CODE_SIGN_IDENTITY = "iPhone Developer"; 451 | CODE_SIGN_STYLE = Manual; 452 | CURRENT_PROJECT_VERSION = 1; 453 | DEVELOPMENT_TEAM = 36APS3J9VX; 454 | GENERATE_INFOPLIST_FILE = YES; 455 | INFOPLIST_FILE = KwaiOpenSDKDemo/Info.plist; 456 | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Photo Library Access Warning"; 457 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 458 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 459 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 460 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 461 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 462 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 463 | LD_RUNPATH_SEARCH_PATHS = ( 464 | "$(inherited)", 465 | "@executable_path/Frameworks", 466 | ); 467 | MARKETING_VERSION = 1.0; 468 | PRODUCT_BUNDLE_IDENTIFIER = com.jiangjia.kwai.kwappsdk; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | PROVISIONING_PROFILE_SPECIFIER = "kwappsdk-dev"; 471 | SWIFT_EMIT_LOC_STRINGS = YES; 472 | TARGETED_DEVICE_FAMILY = "1,2"; 473 | }; 474 | name = Release; 475 | }; 476 | /* End XCBuildConfiguration section */ 477 | 478 | /* Begin XCConfigurationList section */ 479 | BBADB1C8288002D1006F7869 /* Build configuration list for PBXProject "KwaiOpenSDKDemo" */ = { 480 | isa = XCConfigurationList; 481 | buildConfigurations = ( 482 | BBADB1E4288002D3006F7869 /* Debug */, 483 | BBADB1E5288002D3006F7869 /* Release */, 484 | ); 485 | defaultConfigurationIsVisible = 0; 486 | defaultConfigurationName = Release; 487 | }; 488 | BBADB1E6288002D3006F7869 /* Build configuration list for PBXNativeTarget "KwaiOpenSDKDemo" */ = { 489 | isa = XCConfigurationList; 490 | buildConfigurations = ( 491 | BBADB1E7288002D3006F7869 /* Debug */, 492 | BBADB1E8288002D3006F7869 /* Release */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | /* End XCConfigurationList section */ 498 | }; 499 | rootObject = BBADB1C5288002D1006F7869 /* Project object */; 500 | } 501 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KwaiOpenSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KwaiOpenSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/KwaiOpenSDKDemoDebug.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.associated-domains 6 | 7 | applinks:your.app.com 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/KwaiOpenSDKDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // KwaiOpenSDKDemo 4 | // 5 | // Created by huangzhenyuan on 2022/7/14. 6 | // Copyright © 2022年 kuaishou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | NSString * appDelegateClassName; 14 | @autoreleasepool { 15 | // Setup code that might create autoreleased objects goes here. 16 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 17 | } 18 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 19 | } 20 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | platform :ios, '10.0' 3 | use_frameworks! 4 | 5 | target 'KwaiOpenSDKDemo' do 6 | 7 | pod 'KwaiSDK' ,'3.7.3' 8 | pod 'CTAssetsPickerController', '~> 3.3.2-alpha' 9 | 10 | end 11 | -------------------------------------------------------------------------------- /Example/ReadMeImages/associated_domains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KwaiSocial/KwaiSDK-iOS/1c39957baf1879c945f3b7882242d5f57a904aec/Example/ReadMeImages/associated_domains.png -------------------------------------------------------------------------------- /KwaiSDK.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "KwaiSDK" 3 | s.version = "3.7.3" 4 | s.summary = "Kwai Open SDK" 5 | s.homepage = "https://github.com/KwaiSocial/KwaiSDK-iOS" 6 | s.author = { "gaomingbo" => "gaomingbo@kuaishou.com" } 7 | s.license = { :type => "MIT" } 8 | s.source = { :git => "https://github.com/KwaiSocial/KwaiSDK-iOS.git", :tag => s.version.to_s } 9 | s.source_files = "libKwaiSDK/Headers/**/*.h" 10 | s.vendored_libraries = "libKwaiSDK/ios/*.a" 11 | s.ios.deployment_target = "12.0" 12 | s.static_framework = true 13 | s.frameworks = "WebKit" 14 | s.pod_target_xcconfig = { "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } 15 | s.user_target_xcconfig = { "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } 16 | end 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 此Demo是iOS端接入快手OpenSdk的完整示例,供开发者参考。 2 | 3 | 详细接入文档请参考:[快手开放平台](https://open.kuaishou.com/platform/openApi?menu=8) 4 | -------------------------------------------------------------------------------- /libKwaiSDK/Headers/KSApi.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSApi.h 3 | // KwaiSDK 4 | // 5 | // Created by MingBo Gao on 2019/12/11. 6 | // 7 | 8 | #import 9 | #import "KSApiObject.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | #pragma mark - KSApiDelegate 14 | 15 | /// 接受并处理来自快手终端的事件消息 16 | /// KSApiDelegate 需要在registerApp:universalLink:delegate:注册 17 | @protocol KSApiDelegate 18 | @optional 19 | 20 | /// 发送一个request后,收到快手终端的回应 21 | /// @param response 具体的回应内容,回应类型详见KSApiObject.h 22 | - (void)ksApiDidReceiveResponse:(__kindof KSBaseResponse *)response; 23 | 24 | @end 25 | 26 | #pragma mark - KwaiSDKLogDelegate 27 | 28 | @protocol KwaiSDKLogDelegate 29 | 30 | - (void)onLog:(NSString*)log logLevel:(KwaiSDKLogLevel)level; 31 | 32 | - (void)onStatistics:(NSString*)key value:(NSString *)value; 33 | 34 | @end 35 | 36 | #pragma mark - KSApi 37 | 38 | /// 快手Api接口函数类 39 | /// 封装了快手终端SDK的所有接口 40 | @interface KSApi : NSObject 41 | 42 | /// 应用启动时调用此函数向快手终端SDK注册第三方应用 43 | /// @param appId 快手开发者ID 44 | /// @param universalLink 快手开发者UniversalLink 45 | /// @param delegate KSApiDelegate对象,用来接收快手触发的消息 46 | /// @return 注册成功返回YES,失败返回NO 47 | + (BOOL)registerApp:(NSString *)appId 48 | universalLink:(NSString *)universalLink 49 | delegate:(nullable id)delegate; 50 | 51 | /// 检查目标app是否已经被用户安装 52 | /// @return 已安装返回YES,未安装返回NO 53 | + (BOOL)isAppInstalledFor:(KSApiApplication)application; 54 | 55 | /// 判断当前快手APP是否支持快手开放SDK 56 | /// 支持返回YES,不支持返回NO 57 | + (BOOL)isKSAppSupportApi; 58 | 59 | /// 判断当前快手APP是否支持视频裁切 60 | /// 支持返回YES,不支持返回NO 61 | + (BOOL)isKSAppSupportMediaApi; 62 | 63 | /// 判断当前快手APP是否支持视频发布、图片视频编辑 64 | /// 支持返回YES,不支持返回NO 65 | + (BOOL)isKSAppSupportMediaApiV2; 66 | 67 | /// 获取当前快手SDK的版本号 68 | /// @return 快手SDK版本号 69 | + (NSString *)apiVersion; 70 | 71 | /// 发送请求到快手 72 | /// @param request 发送的请求对象 73 | /// @param completion 调用结果回调block 74 | + (void)sendRequest:(KSBaseRequest *)request completion:(void (^ __nullable)(BOOL success))completion; 75 | 76 | /// 处理快手通过scheme方式唤起第三方应用时传递的数据 77 | /// 需要在 application:openURL:sourceApplication:annotation:或者application:handleOpenURL中调用 78 | /// @param url 快手唤起第三方应用时传递的url 79 | /// @return 成功返回YES,失败返回NO 80 | + (BOOL)handleOpenURL:(NSURL *)url; 81 | 82 | /// 处理快手通过UniversalLink方式唤起第三方应用时传递的数据 83 | /// 需要在AppDelegate或SceneDelegate的continueUserActivity中调用 84 | /// @param userActivity 快手唤起第三方应用时系统API传递过来的userActivity对象 85 | /// @return 成功返回YES,失败返回NO 86 | + (BOOL)handleOpenUniversalLink:(NSUserActivity *)userActivity; 87 | 88 | /// 针对swiftUI应用,处理快手通过UniversalLink方式唤起第三方应用时传递的数据 89 | /// 需要在onOpenURL中调用 90 | /// @param url 快手唤起第三方应用时系统API传递过来的URL对象 91 | /// @return 成功返回YES,失败返回NO 92 | + (BOOL)handleOpenUniversalLinkURL:(NSURL *)url; 93 | 94 | /// 日志打印方法 95 | /// @param level 打印log级别 96 | /// @param logDelegate log代理对象 97 | + (void)startLogByLevel:(KwaiSDKLogLevel)level logDelegate:(id)logDelegate; 98 | 99 | @end 100 | 101 | NS_ASSUME_NONNULL_END 102 | -------------------------------------------------------------------------------- /libKwaiSDK/Headers/KSApiObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // KSApiObject.h 3 | // KwaiSDK 4 | // 5 | // Created by MingBo Gao on 2019/11/29. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | ///@brief 错误码 14 | typedef NS_ENUM(NSInteger, KSErrorCode) { 15 | KSErrorCodeSuccess = 1, /**< 成功 */ 16 | KSErrorCodeCancelled = -1, /**< 用户取消授权 */ 17 | KSErrorCodeKwaiAppNotInstalled = -1005, /**< 快手 App 未安装 */ 18 | KSErrorCodeFeatureNotSupportedByKwaiApp = -1006, /**< 快手 App 当前版本不支持该功能 */ 19 | KSErrorCodeBadParameter = -1010, /**< 参数不合法 */ 20 | KSErrorCodeUnauthorizedCMD = 20088, /**< 未授权的cmd */ 21 | KSErrorCodeInvalidOpenID = 20089, /**< 无效的 openid */ 22 | KSErrorCodeInvalidCMD = 20090, /**< 无效的cmd */ 23 | KSErrorCodeUnmatchedUser = 20091, /**< 第三方 App 授受登录的快手账号与快手 App 登录的快手账号不一致 */ 24 | KSErrorCodeActionBlockedForUserRelation = 20092, /**< 当前用户关系不支持该操作,比如:非双关用户之间不能发私信 */ 25 | KSErrorCodeInvalidTargetOpenID = 20094, /**< 非法的 target open id */ 26 | KSErrorCodeInvalidParam = 100200100, /**< 缺少必要的请求参数, server 返回 */ 27 | KSErrorCodeUnauthorizedApp = 100200101, /**< app非法,例如开发者不存在,app不存在或状态不正确等 */ 28 | KSErrorCodeDenied = 100200102, /**< 请求被拒绝 */ 29 | KSErrorCodeUnsupportedResponseType = 100200103, /**< responseType错误 */ 30 | KSErrorCodeUnsupportedGrantType = 100200104, /**< 换取accessToken使用的grantType错误 */ 31 | KSErrorCodeInvalidGrant = 100200105, /**< 换取accessToken使用的code错误 */ 32 | KSErrorCodeInvalidScope = 100200106, /**< 无效的 Scope */ 33 | KSErrorCodeInvalidOpenId = 100200107, /**< 用户的openId无效 */ 34 | KSErrorCodeTokenExpried = 100200108, /**< access_token 或者 refresh_token 过期 */ 35 | KSErrorCodeAuthorizationCanceled = 100200109, /**< 用户取消授权 */ 36 | KSErrorCodeAuthorizationExpried = 100200110, /**< 用户授权过期 */ 37 | KSErrorCodeUnauthorizedScope = 100200111, /**< 用户未授权过所需 scope */ 38 | KSErrorCodeServerError = 100200500, /**< 服务器内部错误,开发者无法处理 */ 39 | }; 40 | 41 | ///@brief 错误码 42 | typedef NS_ENUM(NSInteger, KwaiSDKLogLevel) { 43 | KwaiSDKLogLevelNormal = 0, // 打印日常的日志 44 | KwaiSDKLogLevelDetail = 1, // 打印详细的日志 45 | }; 46 | 47 | typedef NS_ENUM(NSInteger,KSShareScene) { 48 | KSShareScopeSession = 1, 49 | }; 50 | 51 | typedef NS_ENUM(NSInteger, KSShareMediaFeature) { 52 | KSShareMediaFeature_Undefine = -1, /**< 未设置功能 */ 53 | KSShareMediaFeature_Preprocess = 0, /**< 裁剪功能 */ 54 | KSShareMediaFeature_VideoEdit = 1, /**< 视频编辑功能,该能力需要申请权限 */ 55 | KSShareMediaFeature_PictureEdit = 2, /**< 图片编辑功能 */ 56 | KSShareMediaFeature_VideoPublish = 3, /**< 视频发布功能,该能力需要申请权限 */ 57 | KSShareMediaFeature_AICut = 4, /**< 智能裁剪功能 */ 58 | }; 59 | 60 | typedef NS_ENUM(NSInteger, KSApiApplication) { 61 | KSApiApplication_Kwai = 0, 62 | KSApiApplication_KwaiLite, 63 | }; 64 | 65 | typedef NS_ENUM(NSInteger, KSMediaAssociateType) { 66 | KSMediaAssociateNone = 0, 67 | KSMediaAssociateKWApp, 68 | }; 69 | 70 | #pragma mark -KSBase 71 | 72 | /// 该类为快手终端SDK所有请求类的基类 73 | @interface KSBaseRequest : NSObject 74 | 75 | /// 状态值,成功授权后会原样带回 76 | @property (nonatomic, copy, nullable) NSString *state; 77 | 78 | /// 第三方经过快手授权登录授权后得到的openID, 如果当前发起的业务不需要登录授权, 可不传 79 | @property (nonatomic, copy, nullable) NSString *openID; 80 | 81 | /// 设置当前request期望使用的快手体系终端,支持的终端见KSApiApplication 82 | /// 数组内可以设置一个或多个KSApiApplication,SDK内部会按照顺序优先使用可用的终端,若数组为空或不设置则默认使用快手App 83 | /// 目前仅授权登陆KSAuthRequest可以生效 84 | @property (nonatomic, copy, nullable) NSArray *applicationList; 85 | 86 | /// 设置当前请求的额外字段,如无特殊需求可以不设置 87 | @property (nonatomic, copy, nullable) NSDictionary *requestExtraInfo; 88 | 89 | @end 90 | 91 | /// 该类为快手终端SDK所有响应类的基类 92 | @interface KSBaseResponse : NSObject 93 | /// 错误码详见 KSErrorCode 94 | @property (nonatomic, strong) NSError *error; 95 | 96 | /// 状态值,从KSBaseRequest传入,由KSBaseResponse原样带回 97 | @property (nonatomic, copy) NSString *state; 98 | 99 | @end 100 | 101 | #pragma mark -KSAuth 102 | 103 | /// 第三方程序向快手终端请求认证的消息结构 104 | @interface KSAuthRequest : KSBaseRequest 105 | 106 | /// 需要获得的必选权限,多个用“,”链接。比如user_info,relation等 107 | @property (nonatomic, copy) NSString *requiredScope; 108 | /// 可选权限,默认不勾选 109 | @property (nonatomic, copy) NSString *optionalScope0; 110 | /// 可选权限,默认勾选 111 | @property (nonatomic, copy) NSString *optionalScope1; 112 | 113 | /// 当用户设备没有安装快手终端,可以采用sdk内置的h5页面进行授权 114 | /// 若为空,则不会采用h5授权 115 | @property (nonatomic, strong, nullable) UIViewController *h5AuthViewController; 116 | 117 | @end 118 | 119 | /// 快手处理完第三方程序的认证和权限申请后向第三方程序回送的处理结果。 120 | @interface KSAuthResponse : KSBaseResponse 121 | 122 | /// 授权码,客户端通过授权码置换accessToken 123 | @property (nonatomic, copy, nullable) NSString *code; 124 | 125 | @end 126 | 127 | #pragma mark -KSShareMessage 128 | 129 | @interface KSShareWebPageObject : NSObject 130 | 131 | /// H5消息标题 132 | @property (nonatomic, copy) NSString *title; 133 | 134 | /// H5消息描述 135 | @property (nonatomic, copy) NSString *desc; 136 | 137 | /// H5消息缩略图, JPEG 序列化后的数据 138 | /// @attention 缩略图数据不能超过1M 139 | @property (nonatomic, strong) NSData *thumbImage; 140 | 141 | /// H5消息链接地址 142 | @property (nonatomic, copy) NSString *linkURL; 143 | 144 | @end 145 | 146 | @interface KSShareMessageRequest : KSBaseRequest 147 | 148 | /// 分享场景 149 | @property (nonatomic, assign) KSShareScene shareScene; 150 | 151 | /// 接收方 openid , 可选,当不填时,快手 APP 会调启选择好友界面来确定接收方 152 | @property (nonatomic, copy, nullable) NSString *receiverOpenID; 153 | 154 | /// 分享数据,目前支持KSShareWebPageObject 155 | @property (nonatomic, strong) id shareObject; 156 | 157 | @end 158 | 159 | @interface KSShareMessageResponse : KSBaseResponse 160 | 161 | @end 162 | 163 | #pragma mark -KSShowProfile 164 | 165 | @interface KSShowProfileRequest : KSBaseRequest 166 | 167 | /// 要查看的用户的 openID 168 | @property (nonatomic, copy, nullable) NSString *targetOpenID; 169 | 170 | @end 171 | 172 | @interface KSShowProfileResponse : KSBaseResponse 173 | 174 | @end 175 | 176 | #pragma mark -KSShareMedia 177 | 178 | /// 资源描述 179 | @interface KSShareMediaAsset: NSObject 180 | 181 | /// 实例化一个KSShareMediaAsset对象 182 | /// @param assetId PHObject.localIdentifier 183 | /// @param isImage 是否为图片资源 184 | + (instancetype)assetForPhotoLibrary:(NSString *)assetId 185 | isImage:(BOOL)isImage; 186 | 187 | 188 | + (instancetype)assetForAppGroup:(NSString *)pathRelativeToAppGroupRootDir 189 | isImage:(BOOL)isImage; 190 | 191 | @end 192 | 193 | @interface KSMediaAssociateObject : NSObject 194 | 195 | /// 关联资源的标题 196 | @property (nonatomic, copy) NSString *title; 197 | 198 | @end 199 | 200 | /// 关联小程序的信息 201 | @interface KSMediaAssociateKWAppObject : KSMediaAssociateObject 202 | 203 | /// 挂载的小程序的app_id 204 | /// 需满足:1.存在且为小程序类型 2.已在小程序平台中把当前用户id配置到“可发布当前小程序挂件”的用户白名单中 205 | @property (nonatomic, copy) NSString *kWAppId; 206 | 207 | /// 小程序组件跳转到的小程序页面路径 208 | @property (nonatomic, copy) NSString *kWAppPath; 209 | 210 | @end 211 | 212 | /// 分享媒体对象 213 | @interface KSShareMediaObject: NSObject 214 | 215 | /// 在由于各种原因无法完全按照传入参数进行分享的时候,是否允许快手终端进行降级 216 | /// 例如:没有发布页权限的时候回落到裁剪页 217 | @property (nonatomic, assign) BOOL disableFallback; 218 | 219 | /// 视频标签,可以为多个,该能力需要申请权限 220 | @property (nonatomic, copy, nullable) NSArray *tags; 221 | 222 | /// 视频封面资源,支持分享到发布页, 注意这里的封面尺寸应该和media资源尺寸保持一致否则失效 223 | @property (nonatomic, strong) KSShareMediaAsset *coverAsset; 224 | 225 | /// 分段媒体资源 226 | @property (nonatomic, copy) NSArray *multipartAssets; 227 | 228 | /// 关联资源类型 229 | @property (nonatomic, assign) KSMediaAssociateType associateType; 230 | 231 | /// 关联资源的信息 232 | @property (nonatomic, strong) KSMediaAssociateObject *associateObject; 233 | 234 | /// 第三方媒体相关扩展信息,该能力需要申请权限 235 | @property (nonatomic, copy, nullable) NSDictionary *extraEntity; 236 | 237 | @end 238 | 239 | @interface KSShareMediaRequest : KSBaseRequest 240 | 241 | /// 分享功能 242 | @property (nonatomic, assign) KSShareMediaFeature mediaFeature; 243 | 244 | /// 分享数据 245 | @property (nonatomic, strong) KSShareMediaObject *mediaObject; 246 | 247 | @end 248 | 249 | @interface KSShareMediaResponse : KSBaseResponse 250 | 251 | @end 252 | 253 | 254 | NS_ASSUME_NONNULL_END 255 | -------------------------------------------------------------------------------- /libKwaiSDK/KwaiSDK.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "KwaiSDK", 3 | "version": "3.7.3", 4 | "summary": "Kwai Open SDK", 5 | "homepage": "http://git.corp.kuaishou.com/ios/KwaiSDK", 6 | "authors": { 7 | "gaomingbo": "gaomingbo@kuaishou.com" 8 | }, 9 | "license": { 10 | "type": "Copyright", 11 | "text": "kuaishou.com" 12 | }, 13 | "source": { 14 | "path": "." 15 | }, 16 | "ios": { 17 | "public_header_files": "Sources/Public/*.h", 18 | "source_files": "Sources/**/*.{h,m}" 19 | }, 20 | "platforms": { 21 | "ios": "8.0" 22 | }, 23 | "static_framework": true, 24 | "frameworks": "WebKit", 25 | "pod_target_xcconfig": { 26 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64" 27 | }, 28 | "user_target_xcconfig": { 29 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]": "arm64" 30 | }, 31 | "source_files": "Headers/**/*.h", 32 | "vendored_libraries": "ios/*.a" 33 | } 34 | -------------------------------------------------------------------------------- /libKwaiSDK/ios/libKwaiSDK.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KwaiSocial/KwaiSDK-iOS/1c39957baf1879c945f3b7882242d5f57a904aec/libKwaiSDK/ios/libKwaiSDK.a -------------------------------------------------------------------------------- /libKwaiSDK/source.txt: -------------------------------------------------------------------------------- 1 | source= 2 | version= 3 | --------------------------------------------------------------------------------