Firebase/Crashlytics Version 4.0.0-beta.1 - ForceCrash? - swift

How do you force a crash on the new version of Firebase Crashlytics 4.0.0-beta.1?
I have tried to crash the app with fatalError(), but the Crashlytics doesn't record the crash in Dashboard.
Also tried to unplug my device, run the app and force crash with fatalError() but still no report in Dashboard.
Also tried Crashlytics.sharedInstance().crash(), but getting error message Type 'Crashlytics' has no member 'sharedInstance()'.
Any ideas?
Thank you

As the documentation says, use
Crashlytics.sharedInstance().crash()
Crash reports are sent to the server when you start the app again.
Option2: If nothing works, just declare an optional and force unwrap it. :) CRASH
var v : Int!
// then in your viewDidLoad() or in button action
let a = v!

You can use fatalError() instead of Crashlytics.sharedInstance().crash()

For new SDK
import FirebaseCrashlytics
fatalError()

Take a look into your Info.plist, rename the following key and set it TRUE
firebase_crashlytics_collection_enabled -> FirebaseCrashlyticsCollectionEnabled
Or you can also try this
Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(true)

Use pod version in your file pod 'Crashlytics', '~> 3.14.0' .
This code is working in my case.
Crashlytics.sharedInstance().crash()

Firebase (Google) recommends to use just
// Force a test crash
fatalError()
Old API was deprecated and there is no more crash() method or throwException()
Check this
https://firebase.google.com/docs/crashlytics/upgrade-sdk

Related

Sudden error with Xcode 14 RC: Not entitled to listen to push notifications. Please add the 'aps-connection-initiate' entitlement

I just downloaded the Xcode 14 release candidate and I started getting the following crashing error on startup (didn't try the other betas). I made no changes in the codebase. CloudKit was working fine before:
[CK] BUG IN CLIENT OF CLOUDKIT: Not entitled to listen to push notifications. Please add the 'aps-connection-initiate' entitlement.
Under Certificates, Identifiers & Profiles in the Developer portal, I've verified that push notifications are enabled.
To fix, I tried removing and re-adding the push-notifications entitlement.
I verified that the APS Environment value is in the entitlements .plist.
I switched off automatic signing and then turned it back on again. I cleaned the build and deleted derived data. I also tried switching back to Xcode 13.4.1 and everything started working again - unfortunately, not a solution.
The error occurs right as container.loadPersistentStores is called.
lazy var persistentContainer: NSPersistentCloudKitContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentCloudKitContainer(name: "not_real_name")
guard let description = container.persistentStoreDescriptions.first else {
fatalError("No descriptions found (AppDelegate.persistentContainer)")
}
description.setOption(true as NSObject, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
container.loadPersistentStores(completionHandler: {
(storeDescription, error) in
if let error = error as NSError? {
Is this just an Xcode beta bug (in the release candidate)? Is there a way to work around it?
I also just ran into this error today, on the Xcode 14.0 RC. It was on a basically brand new project so I figured it must be something odd with the new version.
To fix, I just did what the error said:
<key>aps-connection-initiate</key>
<true/>
Added that to the app's Info.plist, then it ran again just fine. Also SwiftUI previews started working again.
If you are facing this in simulator. Go to Device -> Erase all content ad settings.. And reinstall the app.
open .entitlements file
and then add "aps-connection-initiate" key and set the value to true
That worked for me

EXC_BAD_ACCESS runtime crash on LmiWindowCreateChild in Vidyo iOS SDK

Getting a runtime crash like that while trying to connect room in Vidyo io SDK.
Thread 1: EXC_BAD_ACCESS on this file. #1 0x0000000103aec9dc in
LmiWindowCreateChild_ at
/tmp/SDK.Release.TRINITY_20_1_0_9.build.7uOSFpBWGF/source/SDK/Lmi/Ui/LmiWindowIPhone.m:394
If you did everything on documentation's said. Removing both UnsafeMutableRawPointer & UnsafePointer like below helped me overcome that runtime crash on newly created Swift app.
If you're still experiencing an error, checking sample app's (from GitHub) build settings may help too.
Documentations should be updated with up-to-date informations by Vidyo.io team.
VCConnectorPkg.vcInitialize()
self.connector = VCConnector(&self.vidyoView,
viewStyle: .default,
remoteParticipants: 4,
logFileFilter: "warning",
logFileName: "",
userData: 0)

Xcode FIREBASE crashes

I have recently upgraded to Swift 4.2 and I am not able to run my project anymore since then.
I had hundreds of mistakes which I all fixed, the app starts but crashes as soon as it tries to access data from my database
example code
guard let currentUser = API.User.CURRENT_USER?.uid else {return}
crash: Thread 1: signal SIGABRT
I had my app working for over a year now and thousands of users so the code worked previously quit fine.
I have updated my cocoa pods to the newest point, as my terminal said that firebaseauth requires at least 1.4 cocoa pods.
I have updated and newly installed all pods, I deleted my plist and downloaded it again and put it into the project, all to no avail.
My app is working if you download the old version from the App Store, but I want to update some things and need it to run again
Any advice? I have tried everything I found
For Firebase 4/5 and Swift 4, here's the function call to get the currently authenticated users uid
guard let currentUser = Auth.auth().currentUser?.uid else { return }

Swift po causes error 'Failed to load linked library Metal'

How can I print out a Swift variable's value in XCode 6 GM with LLDB? It seems to be broken since early betas. But at the same time po works perfectly fine in Objective-C code
I've previously tried all XCode 6 betas and got the same result. Even when I start a new project from scratch it's all the same. For example, I put a breakpoint in func application(application, didFinishLaunchingWithOptions)
(lldb) po application
error: Error in auto-import:
Failed to load linked library Metal of module sandbox - errors:
Looking for "#rpath/Metal.framework/Metal", error: not a string object
I've never imported or linked against Metal.framework in any of my projects. Does there exist any way to solve this?
Don't know the reason that po is broken in xCode 6, but I am able to print an object by
Right clicking an object in the Debug Area
and clicking -> Print Description of "OBJECT_NAME"
Hope this will help someone else, until the xCode bug is fixed
The bug was fixed in XCode 6.1
Resolved Issues - Debugging
Swift expressions like 'expr', 'p', and 'print' that are evaluated
from the LLDB prompt in the debugger console will now work on 32-bit
iOS devices. (18249931)
https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html
Metal.framework is a new framework provided by Apple in iOS8. Seems like AVFoundation has references to it. I think you getting this error running your app on iOS7 device or simulator. Try to check on iOS8.

Unable to run app in Simulator : An error was encountered while running (Domain = LaunchServicesError, Code = 0)

I am unable to run my app in simulator after having trouble with the provisioning profile. I'm doing swift coding in Xcode 6 - beta 4. This was fine before the trouble in the certificate's profile.
I have tried cleaning the build.
Checked the command line to xCode6-beta4 for running.
Checked the build deployment, set to 7.0 so swift won't complain for compatibility
Fixed the error in provisioning.
I fixed it by resetting the simulator:
iOS Simulator > Reset Contents and Settings...
This happens if your extension's bundle ID isn't prefixed with your app's bundle ID. For example if you app is com.mycompany.appname, your extension should be something like com.mycompany.appname.today.
Something else to note, if you're using Swift and are setting a principal class with NSExtensionPrincipalClass, you'll want to make sure your extension target sets "Defines Module" to "Yes" and make the value of NSExtensionPrincipalClass equal to "YourModuleName.YourClassName".
It seems that there are multiple reasons for "domain = LaunchServicesError code = 0" error. I also encountered it, while I try to reinstall app on iOS8 simulator. I cannot reinstall but have to delete the old app first.
The problem was solved by:
In Xcode, fill empty Version or Build field with appropriate value in your Target->General->Identity
In Simulator, reset Content and settings...
After that, everything works fine.
This also happens when you remove the default StoryBoard from template created project of a Today widget. To fix this, I added the NSExtensionPrincipalClass under NSExtension and pointed it to the class containing the Today Widget View Controller, which is by template default TodayViewController.
This looks like this in the Info.plist of the extension:
NSExtension
NSExtensionPointIdentifier String com.apple.widget-extension
NSExtensionPrincipalClass String TodayViewController
Product -> Clean
iOS Simulator > Reset Contents and Settings
Restart XCode
None of the above worked for me, however deleting the Derived Data fixed the issue.
To delete the Derived Data, go to Window > Projects, select the current project, and press the appropriate delete button.
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
The solution for me was not to embed a framework that hadn't been built as an embeddable framework.
Found the cause of the problem for me.
I am using ShareKit via pods. This issue is related to the GooglePlus SDK which ShareKit uses and this has to be updated due to a policy change by Apple.
http://googledevelopers.blogspot.com.br/2014/09/an-important-announcement-for-ios.html
So i replaced my pod "ShareKit" with:
pod "ShareKit/Twitter"
pod "ShareKit/Facebook"
pod "ShareKit/Pocket"
pod "ShareKit/Evernote"
Leaving out the GooglePlus sub project and the application has deployed and runs fine under 8.0 simulators now.
Hope this helps somebody else.
I have resolve this issue. thanks for the advices. :)
This issue always happens when you build your keyboard extension app with same identifier as your main bundle. like this.
If you have this "com.codemagnus.ExAppMain" in your main bundle, your extension should also have this identifier "com.codemagnus.ExAppMain" .. This will result in launch service error if you are going to run in simulator. But you can create a build. However, the issue I have found was annoying. This app can't be install in your device. :/
If you want to run in simulator. You should have this "com.codemagnus.ExAppMain.ExApp" in your extension keyboard where ExApp was you extension name. And your main bundle should be "com.codemagnus.ExAppMain".. This will run perfectly with the simulator. However will result in "Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier."
Embedded Binary Bundle Identifier: com.codemagnus.ExAppMain.ExApp
Parent App Bundle Identifier: com.codemagnus.ExAppMain
I'm still thinking and looking for a solution to solve this issue for ipa build.
This drove me crazy. I checked everything suggested here, reinstalled Xcode, restarted my computer and nothing worked. After checking some previous commits, I found out the issue.
For context, I am working on a custom keyboard extension in Objective C. Adding a new custom keyboard extension target gives you a KeyboardViewController stub class with the "next keyboard" button. I changed the NSExtensionPrincipalClass value in the Info.plist of the extension to be a class name different from KeyboardViewController and started work on it. Eventually I decided to get rid of the the stub KeyboardViewController since it was dead code.
Deleting the KeyboardViewController files and removing them from Xcode caused this problem to happen. Putting them back made the app work again.
In my case, this has resolved the issue.
Bundle Identifier should not be empty. You can find the field with the below reference:
I got this error because I mistakenly changed the value of NSExtensionPointIdentifier. I thought it was supposed to be an ID for my extension, but it has to be one of these values indicating the kind of extension it is.
I started getting this error when I changed my Deployment Target from 6.0 to 7.0. I found that resetting the simulator did solve the issue, and I needed to do this for ALL the simulators that were relevant to the app. But if I went back to 6.0 and recompiled for any particular simulator, then it worked immediately, but going again to 7.0 broke the simulator and I had to clear the settings again.
Obviously the Deployment Target affects the coding in the simulator, and the coding is downward compatible, but not upward. Plus, the log message isn't extremely helpful, saying the app couldn't be hardlinked to a cache file using a manifest (giving the pathnames to the app, cache, and manifest, of course).
Make sure you check build settings; scroll down to the very bottom and make sure your User-Defined Bundle prefix is correct. Usually com.whatever.
Just setting it at the top doesn't always change this bottom setting. This finally worked for me after resetting simulator, frying the derived folder, etc.
I'm under IOS 9.3, xCode 7.3
Xcode 7.3
This could simply happened because your target name is too long. Try change your target name to something shorter ( remember to change your bundleIdentifier to match ).
If you are using apple watch besides the bundle identifier you also have to make sure that in info.plist the key WKAppBundleIdentifier contains the right watch app bundle identifier.
I was getting the similar error while launching the app, thru xCode, "The parent bundle has the same identifier as sub-bundle..."
I shortened the Bundle Identifier in the "Project -> General" for xCode8. Initially, my bundle id was com.companyname..
The application name was more than 20 characters. Once I shortened it 12 characters, it worked for me.
To understand what is causing this error you need to go look at the simulator log files first. These are typically located in ~/Library/Logs/CoreSimulator/CoreSimulator.log or a similar location. So I'd strongly recommend you first look at the log to idenify the root cause and then research that further. (You can take a look at this thread to see where logs are located.)
For example if you get an error such as ErrorDescription=Failed to chmod /Users/username/Library/Developer/CoreSimulator/Devices/then it's probably easiest to reset your simulator. For errors such as ErrorDescription=WatchKit 2 app's bundle ID com.mydomain.AppName.watchapp is not prefixed by the parent app's bundle then there is probably an error with how you have set up the main bundle ID of your project.