Xamarin iOS HockeyApp best practice setup? - xamarin.ios

I'm attempting to get HockeyApp to work in my iOS Xamarin Forms app. I installed the iOS HockeyApp component (v4.1.0), and the getting started information for shows the following:
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
var manager = BITHockeyManager.SharedHockeyManager;
manager.Configure("Your_App_Id");
manager.StartManager();
}
When I try this, BITHockeyManager.SharedHockeyManager is null.
I've tried to wrap these lines in HockeyApp.Setup.EnableCustomCrashReporting() and Setup.EnableCustomCrashReporting() as is referenced in this post, but Setup doesn't exist in the namespaces I have.
What am I missing to properly enable HockeyApp in iOS?

Whoo hoo! Figured it out finally! I had the linker options set to link 'All assemblies' because of a suggestion from the New type registrar in Xamarin.iOS 7.2.1, errors MT5210 and MT5211 thread. I was seeing the 'Native linking failed...' error and switching to 'All assemblies' initially fixed it.
Switching to 'Link SDK assemblies only' fixed both problems

Related

There is a crash when I use MimeKit in Xamrain.IOS

Intalled the Mime Kit and MailKit to packages folder of xamrion.IOS, and try to use them to send an email. It works, but there is a crash when running new MimeMessage()
How to fix this issue.
I am a super beginner with IOS AND Xamarin, thanks very much for your help.
About 6 or 7 lines unable to locate assembly 'I18N' (culture:'')
Log:
2017-07-27 16:18:05.103 AAAA.iOS[523:215341] Xamarin.iOS: Unable to locate assembly 'I18N' (culture: '')
async public void sentEmail(string fileName, string addressEmail)
{
var message = new MimeMessage();
System.Diagnostics.Debug.WriteLine(" SendMail MimeMessage ");
First off, if you are using the simulator you will not be able to send emails using anything that depends on Apple's mail app because it is not installed on the simulator.
If that's not the case, i would recommend using UIMessage instead. Xamarin has great documentation on how to create a pop over view to compose an email and send wit from inside your custom application.
EDIT:
here is the the link to the Xamarin tutorial on sending emails.
You need to go into your iOS Project Options -> iOS Build options and then enable the i18n assemblies to be included.

How do I get telemetry into a Windows 10 UWP App?

The Azure documentation for App Insights doesn't appear to have fresh articles relating to Windows 10 UWP Apps specifically. This appears to be endemic throughout all services (Notification Hub, Mobile Apps, Azure AD, etc.). So far I have found only references to Windows 8/8.1 Universal apps. I'm not sure how applicable they are but some code snippets do seem to compile at least.
My problem is that I have just setup a new App Insights instance for a 'WindowsStore App'. This is intended for a Windows 10 UWP app.
In my app, I have done the following:
Ingested the nuget package for App Insights which has created an ApplicationInsights.config file.
Updated the Instrumentation Key with the one from my WindowsStore App Insights Instance in the Azure Portal.
Added Internet (Client) capability in application manifest.
Created a static TelemetryClient that I use throughout all my Views / View Models.
private static TelemetryClient telemetry = new TelemetryClient();
public static TelemetryClient Telemetry
{
get { return telemetry; }
}
Updated the WindowsAppInitializer to include several WindowsCollectors.
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
WindowsCollectors.Metadata |
WindowsCollectors.Session |
WindowsCollectors.PageView |
WindowsCollectors.UnhandledException
);
Added an event handler within App.xaml.cs for Unhandled Exception and call TelemetryClient.TrackException on the exception.
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
ViewModelDispatcher.Telemetry.TrackException(e.Exception);
}
Added TelemetryClient.TrackPageViews to OnNavigatedTo overrides in my views.
But so far, after doing all that, my App Insights dashboard in the Azure Portal is showing zip, zilch, nada. :\
This makes me think one of two things is going on. Either I am missing some critical piece of this recipe or I'm still within the refresh window for the App Insights Dashboard.
Have you tried to include your instrumentation key to the call of InitializeAsync?
I'm using the following code at the constructor of App class.
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
"YOURINST-RUME-NTAT-IONK-EY012345678",
WindowsCollectors.Metadata |
WindowsCollectors.PageView |
WindowsCollectors.Session |
WindowsCollectors.UnhandledException);
I haven't confirmed the current specs (yes...the documentation of ApplicationInsight is an labyrinth :( ), but from AI v1.0, you have not to include your instrumentation key to your applicationinsight.config. Instead of it, you can specify the key with the call of initializer.
Recently found this (i work on the AI team and it still happened to me!).
If you manually added the applicationinsights.config file, make sure it is set to "Content" and "Copy if newer" in the project settings. If it isn't, then the sdk can't find the instrumentation key at runtime, since the applicationinsights.config file didn't get deployed to the device.
Update 1/11/2016: i just learned of another issue that can cause this: comments in the xml file that look like xml tags.
If your config file has any comments of the form:
<!-- <InstrumentationKey>anything</InstrumentationKey> -->
Or
<!--
Learn more about Application Insights configuration with ApplicationInsights.config here:
http://go.microsoft.com/fwlink/?LinkID=513840
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
-->
(Like is common in examples you might have gotten online, or migrating from a previous version of the AI SDK's)
If those comments appear in your config file before your real key, then the win10 sdk startup code will find those in the comments instead of your real key.
So if you see debug output that says it is using the literal string "YourKey" instead your actual key, that's the reason. (The win10 sdk uses a regex to find your key instead of loading system.xml assemblies to parse the file)

Default instance(maybe static) of Messenger plugin like MVVM Light

Is there an equivalent in MVVMCross to MVVM Light's Messenger.Default instance(for standalone projects that don't comply with MVVM in Xamarin.iOS).
After looking at threads such as this, this, this
I decided to add the "MvvmCross Messenger" plugin to the PCL and iOS project. Thought I'd have to register the Hub and resolve it from the PCL and iOS projects with something like
// Registering in ViewDidLoad() of iOS project
Mvx.RegisterSingleton<IMvxMessenger>(new MvxMessengerHub());
// Try to resolve and subscribe in PCL and iOS project - both have nuget packages added
_messenger = Mvx.Resolve<IMvxMessenger> ();
_token = _messenger.SubscribeOnMainThread<MyMessage> ((message) => {
OutputLabel.Text = message.Number;
});
However I get a null reference exception right at Mvx.RegisterSingleton. Not too sure what I'm missing. All I'm looking for is the Messenger to function. Do not want any other part of MVVM in this project for now
In MvvmCross we made our messenger optional - so it's in a plugin.
If you want to use it standalone, then you can boot the plugin system using code like that shown in the CrossLight demos - see N=30 and N=39 in http://mvvmcross.blogspot.co.uk/ - and see the android-only demos in https://github.com/MvvmCross/MvvmCross-Tutorials/blob/master/CrossLight/PluginUse/NoBinding/Setup.cs
For iOS, you'll probably need some one-time init code something like:
if (MvxSimpleIoCContainer.Instance != null)
return;
var ioc = MvxSimpleIoCContainer.Initialize();
ioc.RegisterSingleton<IMvxTrace>(new MvxDebugOnlyTrace());
var manager = new MvxLoaderPluginManager();
var registry = new MvxLoaderPluginRegistry(".Touch", manager);
ioc.RegisterSingleton<IMvxPluginManager>(manager);
The code for the messenger itself is in: https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/Messenger/Cirrious.MvvmCross.Plugins.Messenger/MvxMessengerHub.cs
Alternatively... if you don't want Mvx code for binding, dispatcher, etc, then it's probably easier to just use something like the excellent TinyMessenger - https://github.com/grumpydev/TinyMessenger

How to manage views programmatically in an iPad storyboard application using Monotouch

I have created an iPad storyboard application using the newest version of Monotouch. My first screen is a login screen that I only want to show if the user has not saved his credentials. If credentials are available I want to instead navigate to the UITabBarController that is the second scene. I can't seem to find any documentation on how to do this. I tried creating an instance of the UITabBarController and pushing to it but it does not work.
homeScreen = new HomeTabBarNavigator(this.Handle);
this.NavigationController.PushViewController(homeScreen,true);
HomeTabBarNavigator is a UITabBarController that is already linked to other scenes. I get the following error:
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
I assume I am getting this error because I have not defined any views to the ViewControllers property of my HomeTabBarNavigator. I was hoping that those views were already defined but that does not seem to be the case. Any ideas.
The best solution I could find is to call PerformSegue on the controller. Here is some example code:
this.PerformSegue("LoginSegue",this);
The controller that is loaded is the LoginController, and LoginSegue is a Segue that points to the HomeTabBarNavigator. While it is not perfect, the applications loaded the tabbar properly.
I used this stackoverlflow iOS question as the basis for my solution.

Calling Office Communicator via Silverlight Out of Browser

I need to invoke office communicator to create a chat window and phone call directly from Silverlight when running out of browser. When running in browser I do this and it works pretty well:
System.Windows.Browser.HtmlPage.Window.Eval(String.Format("window.open(\"sip:{0}\", target=\"_self\");", sip));
When running out of browser as far as I have gotten is to invoke the Communicator.UIAutomation via a dynamic but honestly I don't know what to do next.
dynamic communicator = AutomationFactory.CreateObject("Communicator.UIAutomation");
Anyone have any suggestions on how to make this work? Searching has yeilded zero results.
A couple thoughts:
Have you tried making the automated Communicator object a var, then setting a breakpoint and digging into the resulting hydrated object? You might find some methods or properties on the object you can use to make things happen.
There's a blog here that describes the Office Communicator SDK and has some sample projects. I think you might be able to include the SDK assemblies in your OOB app and automate Communicator using Microsoft's provided SDK.
The SDK has to be preinstalled in the user machines. There's no easy way to deploy it along your Silvelright OOB application.
You will need the SDK.
You can check the documentation for more details here: C:\Program Files (x86)\Microsoft Office Communicator\SDK\OCSDK.chm
It mainly refers to C#, but most of it could easily be ported to Com Automation. As an example look at the following code to start a conversation
dynamic comm = new ActiveXObject("Communicator.UIAutomation");
dynamic msgrAdv = comm.IMessengerAdvanced;
if(msgrAdv!=null)
{
try
{
object obj = msgrAdv.StartConversation(
1, //CONVERSATION_TYPE.CONVERSATION_TYPE_IM,
sipUris, // object array of signin names
null,
"Testing",
"1",
null);
windowHandle = long.Parse(obj.ToString());
}
catch (COMException ex)
{
this.writeToTextBox(
formReturnErrors.returnComError(ex.ErrorCode)
);
}
I hope this help. Noticed that from the example in the help file I changed some of the members that are defined in the .NET Assembly (which can't be referenced from your C# code). If you need this, I would suggest opening the CommunicatorAPI.dll assembly in Reflector.

Resources