Search code examples
xcodemacosios13mac-catalyst

Can't distribute Mac Catalyst extension


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 ?


Solution

  • 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