Can't distribute Mac Catalyst extension

有些话、适合烂在心里 提交于 2020-06-16 04:36:27

问题


I successfully uploaded to the Appstore for iOS an app with several extensions, but when I try to upload the same app for Mac AppStore ( a Mac Catalyst App ) I get the following error from Xcode on two extensions

ERROR ITMS-90355: "Missing Info.plist value. No value for NSExtensionPrincipalClass found in extension Info.plist   
for MyApp.app/Contents/PlugIns/MyExtension.appex"

These extensions are a Share Extension and an Action Extension that have a storyboard file, so if I set the NSExtensionPrincipalClass key in the Info.plist file I get the following message in console

Invalid Configuration: Either NSExtensionMainStoryboard or NSExtensionPrincipalClass   
must be specified in the extension's Info.plist file but not both.

And of course the extension interface does not appear and nothing works

Anybody got an idea how to solve this?

Alternatively there is the possibility to set only the NSExtensionPrincipalClass key in the Info.plist file and then call the storyboard file programmatically ?

Thank you all in advance

Vanni


回答1:


Right now Apple has resolved the issue and I was able to load the app with an extension without problems.




回答2:


Waiting for the Apple answer, I've figure out a workaround consisting to wrap the storyboard to a new AUViewcontroller.

1.  include MyXib_Wrapper.h and MyXib_Wrapper.m
2.  Add to AudioUnitInterface.storyboard the ID mainStoryID
3.  Remove or comment the <AUAudioUnitFactory>  from your derived AUViewController class
4.  Update code in MyXib_Wrapper.m -> createAudioUnitWithComponentDescription according to your code (if you are performing more tasks)
5.  Replace in .plist NSExtensionMainStoryboard with NSExtensionPrincipalClass
6.  Sets MyXib_Wrapper for NSExtensionPrincipalClass and factoryFunction (very important!)

MyXib_Wrapper.h

#import <CoreAudioKit/AUViewController.h>
#import "AudioUnitViewController.h"

@class AudioUnitViewController;

@interface MyXib_Wrapper : AUViewController <AUAudioUnitFactory> {

    AudioUnitViewController *vc;
}
@end

MyXib_Wrapper.m

#import "MyXib_Wrapper.h"
#import "AudioUnitViewController.h"
#import "MyAudioUnit.h"

@implementation MyXib_Wrapper

- (MyAudioUnit *) createAudioUnitWithComponentDescription:(AudioComponentDescription) desc error:(NSError **)error {
    vc.audioUnit = [[MyAudioUnit alloc] initWithComponentDescription:desc error:error];

    // perform here more tasks    
    return vc.audioUnit;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {

        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"AudioUnitInterface" bundle:nil];
        vc = (AudioUnitViewController*) [storyboard instantiateViewControllerWithIdentifier:@"mainStoryID"];
    }
    return self;
}

#pragma mark - View lifecycle
-(UIView*)view {
    return vc.view;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.preferredContentSize = vc.preferredContentSize;
}
@end



回答3:


Taking inspiration from Alessandro Petrolati workaround, I think I found a simpler solution that at least in my case works very well in both extensions.

1.  Replace in .plist NSExtensionMainStoryboard with NSExtensionPrincipalClass
2.  Update YourViewController.m file

Add this init method to your .m class file

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {

        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"YournStoryboardName" bundle:nil];
        self = (YourViewController*) [storyboard instantiateViewControllerWithIdentifier:@"YourStoryboardID"];
    }
    return self;
}

It seems too easy to be true...

The package validation was successful and I finally managed to upload the app to the AppStore Connect without any problems!

All I have to do is to check the latest details before I go live...

Try to believe !

Let me know what your impressions are




回答4:


In my extension I'm using the storyboard, it would be possible to use NSExtensionPrincipalClass instead of NSExtensionMainStoryboard ? Meanwhile, I've sent a feedback to Apple,



来源:https://stackoverflow.com/questions/59765108/cant-distribute-mac-catalyst-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!