I am getting the following error messages when our production iOS app initializes:
[Crashlytics] Version 3.8.4 (121)
[Crashlytics] Running on iOS Simulator (iPhone), 10.3.0 (16E195)
[Crashlytics:Crash] Reporting is disabled
[Crashlytics] Crash reporting could not be initialized
[Answers] Initialized
[Fabric] Initialized with kit versions: {
"com.twitter.answers.ios" = "1.3.4";
"com.twitter.crashlytics.ios" = "3.8.4";
"io.fabric.sdk.ios" = "1.6.11";
}
Every subsequent call to log an event gets the following error:
[Crashlytics:Crash] WARNING: CLSLog has been used before (or concurrently with)
Crashlytics initialization and cannot be recorded. The message was: ...
The non-production versions of the app work fine running the exact same code but with different bundleIDs. Normally when the app initializes for the first time, then I see the app populate in the Fabric dashboard, but in this case the app is not showing up.
We have an Android and an iOS version of the app, and they both use the same bundleID, so I am wondering if there is a conflict because of that? I see the Android version of the app in the dashboard, and it seems to be working properly. This is an app that originally was a Xamarin app that compiled to both platforms, neither of which incorporated Fabric/Crashlytics. We have now written native apps on each platform, and both are using Fabric/Crashlytics.
Since this is a pre-existing app in both stores, we do not have the option of changing either app’s bundleID.
Make sure you initialize Crashlytics with Fabric before calling any Crashlytics methods:
Fabric.with([Crashlytics.self])
One step I routinely miss is to make sure you've added the build phase on your target:
"${PODS_ROOT}/Fabric/run" ${FABRIC_API_KEY} ${FABRIC_BUILD_SECRET}
and either replace ${FABRIC_API_KEY} and ${FABRIC_BUILD_SECRET} with your key and secret or add custom build settings for each.
There are apparently cases where Crashlytics does not auto-activate new apps so that they show up under your list of apps, even though everything is coded correctly and data is going to their servers. In this case, send an email to Crashlytics support (support#fabric.io) that contains a copy of the info.plist entries for the app in question and they will activate it for you. I have had to do this several times, especially with app extensions.
When I finally traced it down in my situation, the error was entirely correct, but not obvious.
I saw these errors in various testing targets where the code we tested was using a custom logging wrapper which called CLSNSLogv(), but the test didn't actually go through the AppDelegate and therefore did NOT initialize Crashlytics. After trying a few things I was convinced that it worked when executed as an app, but in our configuration it was not working under the unit test configuration.
I'll likely alter our custom wrapper to bypass CLSNSLogv() during testing anyway. The biggest benefit of using that is when crashes occur on devices, so we won't be missing anything.
Related
I am working on a Xamarin Forms app pointed at iOS, this works fine in debug, and on Android. Though when we are launching in release mode the app opens and closed immediately.
Monitoring the console for the iPhone I am seeing this error:
COSMCtrl _foregroundAppActivity incoming bundle <app name> has nil supplied UUID
Would this be the potential cause? I have a lifecycle class that is async being called which populates the MainPage, but not sure if it is a background thread being fired that is causing this issue like I assume or other potential causes.
There are other errors like:
Advisor: No handle found for currently focused PID
and
Scene FBSceneManager/SceneID:<appname> update failed:
Any help or suggestions appreciated.
Resolved the issue by putting the app to SDK only linking.
Reference: https://learn.microsoft.com/en-us/xamarin/ios/deploy-test/linker?tabs=windows
I'm trying to set up a new organization to make sure that Debug (debugger not attached) builds' crashes are not dirtying the production Crashlytics. For Debug builds, I use a different organization and a different one for Release.
I am trying to achieve this by changing the API Keys & Build Secret. The problem that I'm facing is that with the new organization my crashes are not getting logged. I've double checked the API Key & Build Secret.
I see logs like these:
Crashlytics:Crash] Reporting is disabled
[Crashlytics] Crash reporting could not be initialized
The code I'm using to initialize Crashlytics looks like this ->
Fabric.with([Crashlytics.start(withAPIKey: my_private_api_key), Answers.self])
The crash reporting is working fine with the older organization, it's just the newer organization that's causing issues.
I've seen a previous question asked here and done a fair bit of researching + trial and error but I've not been able to find a solution.
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 trying to run in Xcode both the main App (which is active in background) and the WatchkitApp (which sends requests to main App through the watchkit extension). Everything works fine in standalone, but no way to make it work simultaneously.
My main concern is to understand this message when trying to attach a process: what does this mean ?
Xcode couldn't attach to "myApp"
"myApp" does not support a debuggable architecture
Thank you.
Edit:
I just read that main app in ObjectiveC and watch app in swift is a problem: https://mkswap.net/m/blog/How+to+debug+an+iOS+app+while+the+WatchKit+app+is+currently+running+in+the+simulator
It happened to me when an extension process was hanging around refusing to terminate. Find and kill it in the Activity Monitor.
Actually, I had that same error message, and I fixed it by resolving a bug that crashed my phone app on launch.
I didn't think to run just the phone in debug so I got confused too.
I'm running ObjC on the phone and Swift on the Watch App.
I've got an app that crashes even before the debugger can connect.
I placed a break point on the first line of main(). (I added an NSLog statement as very first statement in main() and set the break point there.
The app seems to start. The main screen with some ui elements becomes visible on the screen. Then it disappears.
There is no crash log found on the devices.
Xcode message:
Could not launch "appname"
process launch failed: failed to get the task for process xyz
Debugging is enabled of course.
The same for the profiler Instruments.
Code signing works fine so that the app can be deployed to the devices.
(Same for enterprise distribution. And the app validates for store submission.)
It does work on the simulator though.
The app used to work fine. I was just about to build it for the store. For final tests on iOS 8.1 I upgraded to Xcode 6.1 with SDK 8.1. But the problem did not occur directly after the upgrade. It worked just fine.
Then it crashed when building for release for enterprise distribution.
The AppStore build crashed in the same manner (according to Apple, the app was rejected of course.)
But it ran nicely in debug modes.
Now I was trying whether compiler options for optimization may make all the difference and I was trying to build in release mode with debugging enabled etc and end up with a debug build crashing as well. (No optimization in debug).
So it may well be that the migration to Xcode 6.1 did cause it but the problem may have come effective only after Xcode cleaned and rebuild the project in response to changes to compiler settings for code optimization.
Sorry for the long text. I tried to put everything in that may be of importance.
Reason is most likely some incompatibility of Crackify and iOS 8.1.
Therefore it may be of interest for others, altough my problem along with these symptoms may be very special.
Very early within AppDelegate didFinishLaunchingWithOptions we have had the following statement.
if ([Crackify isCracked] || [self isCertificateUnvalid])
exit(173);
That, as such, is not really well designed. The app is just terminated rather than any error message displayed to the user. Thus, it appears as if the app has crashed. But it has not crashed and therefore no crashlog is provided.
For reasons which I don't yet understand and which may not be related to this error, my debugger did not manage to hook up into the executed app. Once that was overcome (suddenly the debugger worked without any changes made to any of the debugging related settings) the error was found rather quickly.
This is Crackify: https://github.com/itruf/crackify
Within Crackify it was this code sniplet that caused the problem:
static NSString *str2 = #"ResourceRules.plist";
BOOL fileExists3 = [manager fileExistsAtPath:([NSString stringWithFormat:#"%#/%#", bundlePath, str2])];
if (!fileExists3) {
return YES;
}
For reasons that I did not further investigate, the file, that is tested here, apparently does not exist in iOS 8.1 any more.