Пример #1
0
        public override void FinishedLaunching(UIApplication application)
        {
            viewController = new MonkeyDocumentViewController();

            Window = new UIWindow(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor    = UIColor.White,
                Bounds             = UIScreen.MainScreen.Bounds,
                RootViewController = viewController
            };
            Window.MakeKeyAndVisible();

            // GetUrlForUbiquityContainer is blocking, Apple recommends background thread or your UI will freeze
            ThreadPool.QueueUserWorkItem(_ => {
                CheckingForiCloud = true;
                Console.WriteLine("Checking for iCloud");
                var uburl = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null);
                // OR instead of null you can specify "TEAMID.com.your-company.ApplicationName"

                if (uburl == null)
                {
                    HasiCloud = false;
                    Console.WriteLine("Can't find iCloud container, check your provisioning profile and entitlements");

                    InvokeOnMainThread(() => {
                        var alertController = UIAlertController.Create("No \uE049 available",
                                                                       "Check your Entitlements.plist, BundleId, TeamId and Provisioning Profile!", UIAlertControllerStyle.Alert);
                        alertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Destructive, null));
                        viewController.PresentViewController(alertController, false, null);
                    });
                }
                else
                {
                    HasiCloud = true;
                    iCloudUrl = uburl;
                    Console.WriteLine("yyy Yes iCloud! {0}", uburl.AbsoluteUrl);
                }
                CheckingForiCloud = false;
            });

            FindDocument();
        }
Пример #2
0
		public override void FinishedLaunching (UIApplication application)
		{
			viewController = new MonkeyDocumentViewController ();

			Window = new UIWindow (UIScreen.MainScreen.Bounds) {
				BackgroundColor = UIColor.White,
				Bounds = UIScreen.MainScreen.Bounds,
				RootViewController = viewController
			};
			Window.MakeKeyAndVisible ();

			// GetUrlForUbiquityContainer is blocking, Apple recommends background thread or your UI will freeze
			ThreadPool.QueueUserWorkItem (_ => {
				CheckingForiCloud = true;
				Console.WriteLine ("Checking for iCloud");
				var uburl = NSFileManager.DefaultManager.GetUrlForUbiquityContainer (null);
				// OR instead of null you can specify "TEAMID.com.your-company.ApplicationName"

				if (uburl == null) {
					HasiCloud = false;
					Console.WriteLine ("Can't find iCloud container, check your provisioning profile and entitlements");

					InvokeOnMainThread (() => {
						var alertController = UIAlertController.Create ("No \uE049 available",
						"Check your Entitlements.plist, BundleId, TeamId and Provisioning Profile!", UIAlertControllerStyle.Alert);
						alertController.AddAction (UIAlertAction.Create ("OK", UIAlertActionStyle.Destructive, null));
						viewController.PresentViewController (alertController, false, null);
					});
				} else {
					HasiCloud = true;
					iCloudUrl = uburl;
					Console.WriteLine ("yyy Yes iCloud! {0}", uburl.AbsoluteUrl);
				}
				CheckingForiCloud = false;
			});

			FindDocument ();
		}