
TAVMagicUIKit.framework (SDK) and TAVMagicUIKit.bundle (icon assets required by the UIKit interface).TAVMagicUIKit.framework and TAVMagicUIKit.bundle from the TAVMagicUIKit SDK into your project directory.pod 'TAVMagicUIKit', :podspec => "https://mediacloud-76607.gzc.vod.tencent-cloud.com/TAVMagic/iOS/Release/1.6.2.0/TAVMagicUIKit.podspec"# TAVMagicUIKit depends on TencentEffect_Edit beauty library & TAVMagic core SDKpod 'TencentEffect_Edit', :podspec => 'https://mediacloud-76607.gzc.vod.tencent-cloud.com/TencentEffect/iOS/edit/4.1.0.4/TencentEffect_Edit.podspec'pod 'TAVMagic',:podspec => 'https://mediacloud-76607.gzc.vod.tencent-cloud.com/TAVMagic/iOS/Release/latest/TAVMagic.podspec'
pod install in the Podfile directory to install dependencies.resource from TAVMagicUIKitSample and drag it into your app project.//If you only want to trigger a download or update the license without caring about the authentication result, pass null as the 4th parameter.[TELicenseCheck setTELicense:<#licenseUrl#> key:<#licenseKey#> completion:^(NSInteger authresult, NSString * _Nonnull errorMsg) {if (authresult == TELicenseCheckOk) {//Authentication succeeded} else {//Authentication failed}}];
TAVMagicUIKIT.framework contains all the UI for the editing interface and exposes the album picker control and editor controller control APIs. It internally depends on TAVMagicSDK.TAVMagicUIKIT.framework to present the album and listen for the callback of selected album assets.#import <TAVMagicUIKit/TAVAlbumPickerController.h>#import <TAVMagicUIKit/TAVAlbumAuthorizer.h>#import <TAVMagicUIKit/TAVAlbumPickerFactory.h>// Request album permission[TAVAlbumAuthorizer checkAlbumAuthorize:^(PHAuthorizationStatus status) {// Present the album picker[self showPickerVC];}];// Present the album picker- (void)showPickerVC{TAVAlbumPickerOptions *options = [TAVAlbumPickerFactory defaultAlbumPickerOptions];TAVAlbumPickerController *pickerController = [[TAVAlbumPickerController alloc] initWithOptions:options];pickerController.modalPresentationStyle = UIModalPresentationFullScreen;pickerController.pickerDelegate = self;[self presentViewController:pickerController animated:YES completion:nil];}
#pragma mark - TAVAlbumPickerControllerDelegate- (void)albumPickerController:(TAVAlbumPickerController *)pickerController didFinishPickingAlbumAssets:(NSArray<TAVAlbumAsset*> *)albumAssets{// Get the path of albumAssets resources and add them to TAVMagic SDKdispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{NSMutableArray *resources = [NSMutableArray array];for (TAVAlbumAsset *mediaItem in albumAssets) {TAVAlbumResource *resource;if (mediaItem.mediaType == TAVAlbumAssetTypeVideo) {resource = [self videoResourceWithPHAsset:mediaItem.asset];} else if (mediaItem.mediaType == TAVAlbumAssetTypeImage) {resource = [self imageResourceWithPHAsset:mediaItem.asset];}[resources addObject:resource];}dispatch_async(dispatch_get_main_queue(), ^{[self gotoPreviewControllerWithResource:resources];[pickerController dismissViewControllerAnimated:YES completion:nil];});});}
- (void)gotoPreviewControllerWithResource:(NSArray<TAVAlbumResource *> *)resources {TAVEditorPreviewController *previewVC = [[TAVEditorPreviewController alloc] initWithAssetPath:nil resources:resources];self.materialProvider.prepareEditor = nil;[self configPreviewContrller:previewVC];[self.navigationController pushViewController:previewVC animated:YES];}
피드백