I try to use HockeyApp on a iOS project with xamarin forms.
It's working fine on android, but I can't get it working on iOS.
Here's my AppDelegate code for HockeyApp:
var manager = BITHockeyManager.SharedHockeyManager;
manager.Configure("----");
manager.CrashManager.Init();
manager.LogLevel = BITLogLevel.Verbose;
manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;
manager.StartManager();
manager.Authenticator.AuthenticateInstallation();
if (BITHockeyManager.SharedHockeyManager.CrashManager.DidCrashInLastSession)
{
runInSafeMode = true;
Thread.Sleep(5000);
}
Then, later in my code I throw an NotYetImplementedException.
The exception is correctly catched and send to the server on android, but I can't get it working on iOS.
BITHockeyManager.SharedHockeyManager.CrashManager.DidCrashInLastSession is always false.
I also tried without the debugger attached as I read that the debugger catch exception before the SDK, still not working.
Any ideas ?
EDIT : Additional informations
I tried Visual Studio Mobile Center, working fine on android, same issue with iOS, HasCrashedInLastSessionAsync always to false
I moved the throw exception outside of the main method, just in case of, still the same problem, exception looks like not detected by the API
I disabled the debugging in addition of not attaching the debugger, I also tried to compile in Release, nothing new.
I removed the call to Init and AuthenticateInstallation, still the same problem.
Where do you put your Hockey Init code?
I got it working with global::Xamarin.Forms.Forms.Init(); after the Hockey Init in my FinishedLaunching method.
Something like this:
var manager = BITHockeyManager.SharedHockeyManager;
...
manager.StartManager();
global::Xamarin.Forms.Forms.Init();
Related
Today, likely as a result of upgrading to iOS 12.3 on my test phone, I am now receiving the following notifications in my debug console when I first instantiate my MPVolumeView.
019-05-21 11:00:22.874353-0600 sports-audio-dj[3831:982163]
[MediaRemote] OutputDeviceUID is nil Speaker: (null)
I receive about 10+ of these.
Here is the code that kicks it off:
let volumeView = MPVolumeView(frame: self.view.bounds)
My code hasn't changed and I'd not seen this before today and wondering if anyone knows what is bringing this about and if I need to do anything about it if something is now unhappy. My app seems to work fine despite these new notifications.
Apple responded today with the following:
You can safely ignore this debugging message. It will be removed in a future version of iOS.
iOS 13 has finally removed these errant debug messages.
My app is throwing an IllegalAccessError after updating to the latest Android Things
preview. I have the following code to check for an OTA update:
UpdateManager manager = new UpdateManager();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
When I run this code I get the following error output:
java.lang.IllegalAccessError: Method 'void com.google.android.things.update.UpdateManager.<init>()' is inaccessible to class 'com.example.android.things.screensettings.MainActivity' (...)
This code was working before, why has this started happening after the update?
Starting in Preview 7, Android Things API services are not constructed as new
instances. They are instead accessed as singletons via getInstance() to be
more in line with Android API paradigms.
Be sure to update your app to use the Preview 7 SDK:
dependencies {
compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
}
Then modify your code to use getInstance() instead:
UpdateManager manager = UpdateManager.getInstance();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
Review the Android Things API reference
to verify if any of the other APIs you are calling have changed.
I followed this link and added Analytics and Crashes correctly to Android but in iOS only Analytics added correctly. for checking if Crashes is working on iOS, I created some crashes like so:
1.
int a = 0;
int b = 2 / a;
2.
throw new Exception("jiiiiz");
3.
Crashes.GenerateTestCrash();
but non of them are reported to azure crashes panel, I also check if an error happen in next session app is opened but it's always false:
protected override async void OnAppearing()
{
base.OnAppearing();
var a = Crashes.HasCrashedInLastSession;
Debug.WriteLine($"Crashed?? {a}"); // is always false
}
As Mobile Center Crashes documentation mentioned about Troubleshooting:
Right now crash reports are only visible if they can be symbolicated. For that to happen the proper symbols (dSYM) need to be uploaded. There will be a UI available later that shows which symbols are missing and how to find them.
Make sure the app doesn't crash on startup, as the SDK wouldn't have time to send the crash report. This is a limitation for any 3rd party crash reporting service.
For how to provide symbols for your app, you could refer to Uploading symbols.
I've seen several other posts on SO and elsewhere about this error (System.InvalidOperationException: You MUST call Xamarin.Forms.Init(); prior to using it. at Xamarin.Forms.Device.get_PlatformServices), but none of them shed any light on my particular situation.
I've created a Xamarin.Forms application that works great on Android (emulators and device, including when distributed through Google Play), and works fine both on the iPhone simulator and when provisioned to the iPhone. And when I say 'works fine', I mean 'is able to get to the MainPage without error.'
However, when I use Ad-Hoc deployment and upload it to Apple so it can be distributed with TestFlight, the TestFlight-downloaded version shows the splash screen as expected, and then crashes without ever showing the MainPage. In looking at the device logs, the above error appears, and in doing some Internet research, it's become apparent that my AppDelegate needs to have global::Xamarin.Forms.Forms.Init(); as the first line in the FinishedLaunching() method.
So I went to take a look and put that line in that method in that file, and lo and behold, it's already there. This is not unexpected, given the fact that the app works on the sim, and on the iPhone when deployed directly from Visual Studio.
So my question is 'Why does Ad-Hoc deployment fail when all other deployment types do not, and what can I do to overcome this problem and get the app to actually distribute through TestFlight in a runnable fashion?'
I was able to resolve the issue by putting the command (global::Xamarin.Forms.Forms.Init();) first thing in every constructor in every class in the iOS platform-specific services. It's possible that only one was really necessary, but it doesn't seem to have caused any issue to over-deploy that particular command, and in the case that more than one of the services is called before the AppDelegate's FinishedLaunching() method is called, that would seem to be necessary in the first one called, which could potentially vary by program flow, depending on environment and other variables that may be checked.
In .iOS project make sure the line
"global::Xamarin.Forms.Forms.Init();"
is the first line in the event
"public override bool FinishedLaunching(UIApplication app, NSDictionary options)"
in
"AppDelegate.cs" file.
In .UWP VB project make sure the line
"Xamarin.Forms.Forms.Init(e)"
is after the line
"AddHandler rootFrame.NavigationFailed, AddressOf OnNavigationFailed" in
"Protected Overrides Sub OnLaunched(e As Windows.ApplicationModel.Activation.LaunchActivatedEventArgs)" event
in "App.Xaml.vb" file.
In .Android project
"global::Xamarin.Forms.Forms.Init(this, savedInstanceState);"
is after the line
"base.OnCreate(savedInstanceState);"
in "protected override void OnCreate(Bundle savedInstanceState)" event.
Hope this helps.
I am using Cordova(3.2) to develop a web app on iOS, every time I set a breakpoint in javascript(in Safari) of any callback from Cordova native code, the app always crash by a prompt from xCode:
bool _WebTryThreadLock(bool), 0x1f560ad0: Multiple locks on web thread
not allowed! Please file a bug. Crashing now...
I set breakpoint like this:
...
function gotFileEntry(fileEntry) {
fileEntry.file(gotFile, fail); // <<< breakpoint here
}
...
I doubt it because the webview got locked when Cordova called js, then when my breakpoint was triggered, the webview got second lock.
Does anybody know how I can set breakpoint in js in a callback through native code?