Reputation: 6782
I am developing an app using Broadcast Upload Extension - I would like to know how to pass parameters into the BroadcastViewController so I can them pass them onto the CompleteRequest method (userSetup parameter). Or am I suppose to reference the Container app somehow and get the parameters from there?
code from 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);
Upvotes: 0
Views: 661
Reputation: 6782
I solved the issue by using App Groups capability. This allows me to fill in the parameters in the container app and then retrieve them in the extension like this:
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");
Upvotes: 1