Xamarin.iOS app crashes on startup on iOS13 on Testflight - ios

I have tested the application on Testflight and as soon as I open it everything works correctly. The problem comes when I close the app and open it again, at that moment the application crashed and does not let me open it anymore.
I am testing on my iphone 6s with iOS 13.1.3.
Can anyone help me, please?

The App Center SDKs work well for capturing crash information. You can then see it in the App Center Portal

I have already added AppCenter to the project, and now I can see the analytics, but it doesn't catch me crash error.
About the configuration of AppCenter, I have added to the AppDelegate.cs (FinishedLaunching)
AppCenter.Start("bxxxxxxxxxxxxxxxxxxxxxxxxxxx3a0",
typeof(Analytics), typeof(Crashes));
Crashes.NotifyUserConfirmation(UserConfirmation.AlwaysSend);
Crashes.SetEnabledAsync(true);
And to the App.xaml.cs
AppCenter.LogLevel = LogLevel.Verbose;
AppCenter.Start("ios=b41cxxxxxxxxxxxxxxxxxxxxxxxxxx0;" +
"uwp={Your UWP App secret here};" +
"android={Your Android App secret here}",
typeof(Analytics), typeof(Crashes));
Crashes.NotifyUserConfirmation(UserConfirmation.AlwaysSend);
I test the Crashes.GenerateTestCrash on the simulator and It works, but exaclty the iPhone crash no

Related

App is crashing when opening through TestFlight (Swift, iOS)

I have a problem, when I test my iOS App on a real device or when I testing it in the simulator all is working as expected, but when I submit the app to TestFlight and I want to open it on my device the app is instantly crashing on launch. My last changes on the app was that I added the option that the user can pick another App Icon, nothing else. But now the app is crashing in TestFlight. Anybody has an idea what I can do?
Sometimes I get this error:
<NSError: 0x28227d6e0; domain: BSServiceConnectionErrorDomain; code: 3 (OperationFailed); reason: "XPC error received on message reply handler">;and thisMultiple RBSRunningReasonAttribute provided: 13 vs 20254. First one wins, but client should be fixed for assertion 31-112-6223`
I already tried to changes Scheme to Release but nothing changes still works on the simulator and the real device.

IOS 11 breaks (ionic) app

I recently updated my IOS to 11 beta 3, to make sure my ionic app would still work.
However it crashes almost right away with a black screen when I launch it.
I try to debug it with Xcode, however when I build to run it on my iPhone and catch the error, the "running on device" gets stuck on the following :
What can I do with this? I'm stuck with an app doomed to die once ios11 gets released, anyone could help?
The problem is normally caused due to wk web view plugin. Try removing the plugin and run again

Xamarin.UITests - testing on real device - iOS - app permissions popups issue

I've iOS app that needs some privileges (GPS, Push notifications).
When app starts for a first time iOS asks user if they're ok with granting those permissions to application.
I've written some UITests and want to automate running them on locally connected iPhone.
The problem is that I cannot override permissions questions and my tests fails.
I found out that application deployed by IDE (Xamarin Studio) will ask for permissions, but application deployed via UITests will not.
So I tried with .AppBundle(path_to_app) but it says this is only valid for deploying to Simulator.
SetUp : System.Exception : This app bundle is not valid for running on
a simulator. To fix this issue please ensure that your target device
is a simulator. DTPlatformName is 'iphoneos', not 'iphonesimulator' in
the apps Info.plist.
Like it's trying to deploy iPhone app to Simulator. But Target in Xamarin Studio is set to real device.
I tried to add .DeviceIdentifier. When Used with .InstalledApp it was starting up (still asking for permissions).
But when I used DeviceIdentifier and AppBundle there was the same error as above.
My tests works fine on Test Cloud. They work fine on Simulator.
They work fine when I deploy to device manually, start app and approve permissions then run UI tests.
What I cannot achieve is to make UITests override permissions questions on real device.
Anyone made this work?
Last thing is that I found is in documentation for AppBundle method
"Will force a run on simulator"
https://developer.xamarin.com/api/member/Xamarin.UITest.Configuration.iOSAppConfigurator.AppBundle/p/System.String/
So I may be doomed with the task but maybe someone knows a workaround?
You can dismiss system dialogs with UITest by using InvokeUIA. The test below works by tapping the "OK" button of an iOS system alert:
[Test]
public void AppLaunches ()
{
app.Screenshot ("First screen.");
app.InvokeUia ("uia.query('[:view {:marked \"OK\"}]')");
app.InvokeUia ("uia.tapMark(\"OK\")");
}
A working sample app & UITest is also here:
https://github.com/King-of-Spades/InvokeUia-for-System-Dialogs
Warning about system dialogs in Test Cloud
The reason that you don't see this issue in Test Cloud is because Test Cloud automatically dismisses the system alerts; so usually you don't have to worry about it. However, if your alert launches too soon; so that it appears before the automation has fully started your app, then it will be unable to detect & dismiss the alert and cause your test to fail.
So you want to make sure that when running your app in Test Cloud that the request for permissions are delayed, or you can even deactivate them if they aren't explicitly needed for a particular test. More information is available in this Calabash guide: https://github.com/calabash/calabash-ios/wiki/Managing-Privacy-Alerts%3A--Location-Services%2C-APNS%2C-Contacts
(Even though it's Calabash, you can use the same strategy in UITest; albeit with a C# syntax.)
Update for Xcode 8 / iOS 10
Xcode 8 / iOS 10 removed UIAutomation, so the InvokeUIA workaround will only continue to be possible if you're using Xcode 7 and iOS 7-9. References:
UITest: https://developer.xamarin.com/guides/testcloud/UITest/xcode7/
Calabash: https://developer.xamarin.com/guides/testcloud/calabash/xcode7/#Automation_API
For real devices you dont need any of those.
{
app = ConfigureApp
.iOSAppBundle
.StartApp();
}
this piece of code is good enough, if you are connecting real device to the system, then select that before running.
We use this to execute the UI tests on iPhones:
ConfigureApp.iOS.InstalledApp("com.appcenter.UITestDemo").StartApp();
InstalledApp requires you to build an IPA using the Debug
configuration & a valid provisioning profile, and preinstalling it on
the target device.
https://github.com/microsoft/appcenter-Xamarin.UITest-Demo/blob/main/UITestDemo.UITest/AppInitializer.cs
To confirm system dialogs we use this:
private Query ConfirmLocalNetworkPermissionDialogButton
=> AppInitializer.Platform == Platform.iOS
? new Query(x => x.ClassFull("_UIAlertControllerActionView").Marked("OK"))
: x => x.Class("AppCompatButton").Marked("button1");

iOS app crashes immediately when debugging AppleWatch app on Simulator (not on device)

I've got an AppleWatch app that is working fine in Simulator and Device, but when I call openParentApplication, it appears that the parent app is crashing immediately because I see this in the console output:
The UIApplicationDelegate in the iPhone App never called reply()...
When I try to manually launch the parent iOS app in the Simulator it crashes there too immediately. I don't have time to attach the debugger (which is already attached to the AppleWatch app) to see what is crashing it. Note that the parent app runs fine when the AppleWatch is running and I'm using a real iPhone. I can also run the app fine on the Simulator when not debugging the AppleWatch app.
I've tried resetting the Simulator, but problem persists.
I'm just not sure how to debug this. Any help is appreciated.
Start an explicit background task in handleWatchKitRequest. Otherwise, your app gets killed before it reaches reply().
Refer to this post for a code example on how to create a background task.
In turns out that after commenting out all code in the parent app's didFinishLaunching and stripping almost all code out of the watch extension, the problem was indeed at a lower level.
The Simulator has a
Debug | Open System Log...
menu option that showed the crash logs, which contained:
Dyld Error Message: Library not loaded:
#rpath/MyCore.framework/MyCore Referenced from:
/Users/me/Library/Developer/CoreSimulator/Devices/A2061705-DDDF-477C-9AAA-E50GG43A6350/data/Containers/Bundle/Application/DEB7FB25-8233-4B9F-8DAB-9FF8AE42BF33/MyApp.app/MyApp
Reason: no suitable image found. Did find:
/Users/me/Library/Developer/CoreSimulator/Devices/A2061705-DDDF-477C-9AAA-E50FF43A6350/data/Containers/Bundle/Application/DEB7FB25-8553-4B9F-8DAB-9FF8AE95BF33/MyApp.app/Frameworks/MyCore.framework/MyCore:
mach-o, but wrong architecture
My Swift app has a few dependent Swift projects that are used by the app and extension. Getting the Swift frameworks to link has been a major pain. I've included the dependent frameworks (compiled in the same workspace) as embedded binaries. This works when running on the device, or on the Simulator, but not when running in this hybrid watch app + parent app Simulator context.
I changed the embedded binary references to point to the frameworks under ...DerivedData...Debug-iphonesimulator, as opposed to ...DerivedData...Debug-iphoneos, and the problem went away.
Still hoping the Swift framework story will improve.
Are you seeing an actual crash? That message has appeared for me plenty of times without the host app crashing.
99% of the time, that error appears because developers aren't opening a background task to complete their work in handleWatchKitRequest. Without the background task, the OS kills your app in the background before it has a chance to reply.

How can I obtain crash logs for Mobile Safari in the iOS Simulator?

If Mobile Safari crashes in the iOS Simulator, where can the crash logs be found?
(Apple will want these attached to your bug reports.)
Look for files named MobileSafari_*.crash in ~/Library/Logs/DiagnosticReports/.
(Execute open ~/Library/Logs/DiagnosticReports/ in Terminal, then sort by date modified.)

Resources