UICloudSharingController.h
2019-05-28 本文已影响3人
zhYx_
#if USE_UIKIT_PUBLIC_HEADERS || !__has_include(<UIKitCore/UICloudSharingController.h>)
//
// UICloudSharingController.h
// UIKit
//
// Copyright © 2016-2018 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UIViewController.h>
#import <UIKit/UIActivityItemProvider.h>
NS_ASSUME_NONNULL_BEGIN
@class UICloudSharingController, CKShare, CKContainer;
/* 权限选项 <枚举> */
typedef NS_OPTIONS(NSUInteger, UICloudSharingPermissionOptions) {
UICloudSharingPermissionStandard = 0, // Allow the user to configure the share with the standard set of options
UICloudSharingPermissionAllowPublic = 1 << 0, // The user is allowed to share publicly
UICloudSharingPermissionAllowPrivate = 1 << 1, // The user is allowed to share privately
UICloudSharingPermissionAllowReadOnly = 1 << 2, // The user is allowed to grant participants read-only permissions
UICloudSharingPermissionAllowReadWrite = 1 << 3, // The user is allowed to grant participants read/write permissions
} NS_ENUM_AVAILABLE_IOS(10_0) __TVOS_PROHIBITED __WATCHOS_PROHIBITED;
///!!!: 代理 <协议>
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
@protocol UICloudSharingControllerDelegate <NSObject>
- (void)cloudSharingController:(UICloudSharingController *)csc failedToSaveShareWithError:(NSError *)error;
// corresponds to CKShareTitleKey on the expected share
- (nullable NSString *)itemTitleForCloudSharingController:(UICloudSharingController *)csc;
@optional
// corresponds to CKShareThumbnailImageDataKey on the expected share
- (nullable NSData *)itemThumbnailDataForCloudSharingController:(UICloudSharingController *)csc;
// corresponds to CKShareTypeKey on the expected share
- (nullable NSString *)itemTypeForCloudSharingController:(UICloudSharingController *)csc;
- (void)cloudSharingControllerDidSaveShare:(UICloudSharingController *)csc;
- (void)cloudSharingControllerDidStopSharing:(UICloudSharingController *)csc;
@end
#pragma mark - 云共享Controller
#pragma mark -
NS_CLASS_AVAILABLE_IOS(10_0) __TVOS_PROHIBITED __WATCHOS_PROHIBITED @interface UICloudSharingController : UIViewController
/* 实例化方法 */
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
/* Use this initializer when you want to share a set of CKRecords but haven't yet saved a CKShare.
The preparation handler is called when it is time to save the share to the server.
After ensuring the share and record have been saved to the server, invoke the preparationCompletionHandler
with either the resulting CKShare, or an NSError if saving failed.
*/
- (instancetype)initWithPreparationHandler:(void (^)(UICloudSharingController *controller, void (^preparationCompletionHandler)(CKShare * _Nullable, CKContainer * _Nullable, NSError * _Nullable)))preparationHandler;
/// 当您已经拥有之前设置的活动CKShare时,请使用此初始化方法
- (instancetype)initWithShare:(CKShare *)share container:(CKContainer *)container;
/// 代理
@property (nonatomic, weak) id<UICloudSharingControllerDelegate> delegate;
/// 共享记录引用
@property (nonatomic, readonly, strong, nullable) CKShare *share;
/// 权限选项(将共享邀请UI限制为特定类型的共享权限.如果设置,则只能选择指定的权限组合)
@property (nonatomic) UICloudSharingPermissionOptions availablePermissions;
/**
返回与UIActivityViewController一起使用的活动项源。
如果选择了activity,则将为共享控制器的原始实例调用委托方法
@return <#return value description#>
*/
- (id <UIActivityItemSource>)activityItemSource;
@end
NS_ASSUME_NONNULL_END
#else
#import <UIKitCore/UICloudSharingController.h>
#endif