iOS - 广播上传扩展 - UserDidFinishSetup - 从容器应用传递参数

iOS - Broadcast Upload Extension - UserDidFinishSetup - pass parameters from Container app

我正在使用 Broadcast Upload Extension 开发一个应用程序 - 我想知道如何将参数传递到 BroadcastViewController 以便我可以将它们传递到 CompleteRequest 方法(userSetup 参数)。或者我想以某种方式引用容器应用程序并从那里获取参数?

代码来自 BroadcastViewController:

  public partial class BroadcastViewController : UIViewController
        {
            protected BroadcastViewController(IntPtr handle) : base(handle)
            {
                // Note: this .ctor should not contain any initialization logic.
            }

            public void UserDidFinishSetup()
            {
// NEED TO OBTAIN HERE PARAMETERS
                System.Diagnostics.Debug.WriteLine("ScreenShareExtensionUI: UserDidFinishSetup");
                // Broadcast url that will be returned to the application
                var broadcastURL = NSUrl.FromString("http://broadcastURL_example/stream1");

                // Service specific broadcast data example which will be supplied to the process extension during broadcast
                var keys = new[] { "channelName", "token", "appId" };
                var objects = new[] { "channelName", "token", "appId" };
                var setupInfo = NSDictionary.FromObjectsAndKeys(objects, keys);

我使用应用程序组功能解决了这个问题。这允许我在容器应用程序中填写参数,然后在扩展中检索它们,如下所示:

var plist = new NSUserDefaults("group.com.foo.ss", NSUserDefaultsType.SuiteName);
            var agoraApi = plist.StringForKey("agoraApi");
            var agoraRoomId = plist.DoubleForKey("agoraRoomId");
            var agoraToken = plist.StringForKey("agoraToken");
            var agoraUserId = plist.DoubleForKey("agoraUserId");