Reputation: 141
I just started using Adobe Creative Cloud SDK and i'm getting an error as mentioned below.
unknown:0: error: 'AdobeImageEditorPremiumAddOn' is unavailable __ObjC.AdobeImageEditorPremiumAddOn:1:38: note: 'AdobeImageEditorPremiumAddOn' has been explicitly marked unavailable here @availability(*, unavailable) struct AdobeImageEditorPremiumAddOn : RawOptionSetType
This error is generating once i insert the below code
var imageView = AdobeUXImageEditorViewController(image: UIImage(named:"image.png"))
imageView.delegate = self
self.presentViewController(imageView, animated: true, completion: nil)
Even after adding app the frameworks exactly the way they have mentioned
Upvotes: 3
Views: 828
Reputation: 151
Faced the same issue. you need to do the following:
1) Create an Objective C method that takes a UIImage and initializes an 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) create 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) Make sure to add aviary.h to your bridging header
in bridging header file
#import "aviary.h"
4) then simply call the AviaryWrapper class passing on your image
var imageEditor = AviaryWrapper.displayEditorForImage(info[UIImagePickerControllerOriginalImage] as! UIImage)
presentViewController(imageEditor, animated: true, completion: nil)
(or in your case replace info[UIImagePickerControllerOriginalImage] with the actual image you want rendered.
Upvotes: 1
Reputation: 141
The only solution i found as a workaround is to create a Bridging Header and call it from Swift as shown below
This is Objective C
[[AdobeUXImageEditorViewController alloc] initWithImage:[UIImage imageNamed:@"img.jpg"]];
[editorController setDelegate:self];
[self presentViewController:editorController animated:YES completion:nil];
and call the above code from swift as show below
var view = objcViewController()
self.navigationController!.presentViewController(view, animated: true, completion: nil)
if there is any better way to get it done please let me know.
Upvotes: 1