Adobe Creative SDK iOS Swift'AdobeImageEditorPremiumAddOn'不可用错误

时间:2015-03-09 14:49:57

标签: ios swift sdk adobe

我刚刚开始使用Adobe Creative Cloud SDK,并且我收到了如下所述的错误。

  

unknown:0:错误:' Adob​​eImageEditorPremiumAddOn'不可用   __ObjC.AdobeImageEditorPremiumAddOn:1:38:注意:' Adob​​eImageEditorPremiumAddOn'已被明确标记为不可用   这里@availability(*,不可用)struct Adob​​eImageEditorPremiumAddOn   :RawOptionSetType

一旦插入以下代码

,就会生成此错误
var imageView = AdobeUXImageEditorViewController(image: UIImage(named:"image.png"))

imageView.delegate = self
self.presentViewController(imageView, animated: true, completion: nil)

即使在完全按照他们提到的方式添加app框架

之后

2 个答案:

答案 0 :(得分:1)

我发现作为解决方法的唯一解决方案是创建一个桥接头并从Swift调用它,如下所示

这是目标C

[[AdobeUXImageEditorViewController alloc] initWithImage:[UIImage    imageNamed:@"img.jpg"]];

[editorController setDelegate:self];

[self presentViewController:editorController animated:YES completion:nil]; 

并从swift调用上面的代码,如下所示

 var view = objcViewController()
 self.navigationController!.presentViewController(view, animated: true, completion: nil)

如果有更好的方法可以完成,请告诉我。

答案 1 :(得分:1)

面临同样的问题。你需要做以下事情:

1)创建一个Objective C方法,该方法接受UIImage并初始化一个AdobeUXImageEditorViewController

aviary.m

#import "aviary.h"

@implementation AviaryWrapper

+ (AdobeUXImageEditorViewController *)displayEditorForImage:(UIImage *) imageToEdit
{

    NSString* const CreativeSDKClientId = @""; //TODO use correct value
    NSString* const CreativeSDKClientSecret = @"";

    [[AdobeUXAuthManager sharedManager] setAuthenticationParametersWithClientID:CreativeSDKClientId withClientSecret:CreativeSDKClientSecret];

    AdobeUXImageEditorViewController *editorController = [[AdobeUXImageEditorViewController alloc] initWithImage: imageToEdit];

    return editorController;

}
@end

2)创建aviary.h

#ifndef HelloWorld_aviary_h
#define HelloWorld_aviary_h

#import <Foundation/Foundation.h>
#import <AdobeCreativeSDKFoundation/AdobeCreativeSDKFoundation.h>
#import <AdobeCreativeSDKImage/AdobeCreativeSDKImage.h>



@interface AviaryWrapper : NSObject

+ (AdobeUXImageEditorViewController *)displayEditorForImage:(UIImage *) imageToEdit;

@end

#endif

3)确保将aviary.h添加到您的桥接标题

在桥接头文件

#import "aviary.h"

4)然后只需调用AviaryWrapper类传递你的图像

 var imageEditor = AviaryWrapper.displayEditorForImage(info[UIImagePickerControllerOriginalImage] as! UIImage)
 presentViewController(imageEditor, animated: true, completion: nil)

(或者在您的情况下将info [UIImagePickerControllerOriginalImage]替换为您想要渲染的实际图像。