diff --git a/crashlytics-ios-link/src/main/kotlin/co/touchlab/crashkios/CrashlyticsLinkPlugin.kt b/crashlytics-ios-link/src/main/kotlin/co/touchlab/crashkios/CrashlyticsLinkPlugin.kt index f4ab684..b9f5919 100644 --- a/crashlytics-ios-link/src/main/kotlin/co/touchlab/crashkios/CrashlyticsLinkPlugin.kt +++ b/crashlytics-ios-link/src/main/kotlin/co/touchlab/crashkios/CrashlyticsLinkPlugin.kt @@ -29,10 +29,7 @@ internal val Project.kotlinExtension: KotlinMultiplatformExtension get() = exten class CrashlyticsLinkPlugin : Plugin { override fun apply(project: Project): Unit = project.withKotlinMultiplatformPlugin { - val linkerArgs = "-U _FIRCLSExceptionRecordNSException " + - "-U _OBJC_CLASS_\$_FIRStackFrame " + - "-U _OBJC_CLASS_\$_FIRExceptionModel " + - "-U _OBJC_CLASS_\$_FIRCrashlytics" + val linkerArgs = "-U _FIRCLSExceptionRecordNSException" afterEvaluate { project.kotlinExtension.crashLinkerConfig(linkerArgs) project.kotlinArtifactsExtension.crashLinkerConfigArtifacts(linkerArgs) diff --git a/crashlytics/src/appleMain/kotlin/co/touchlab/crashkios/crashlytics/CrashlyticsCallsActual.kt b/crashlytics/src/appleMain/kotlin/co/touchlab/crashkios/crashlytics/CrashlyticsCallsActual.kt index 1ad5fbc..9723aa2 100644 --- a/crashlytics/src/appleMain/kotlin/co/touchlab/crashkios/crashlytics/CrashlyticsCallsActual.kt +++ b/crashlytics/src/appleMain/kotlin/co/touchlab/crashkios/crashlytics/CrashlyticsCallsActual.kt @@ -7,30 +7,32 @@ import kotlinx.cinterop.convert @OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) actual class CrashlyticsCallsActual : CrashlyticsCalls { + + override fun logMessage(message: String) { - FIRCrashlytics.crashlytics().log(message) + FIRCrashlyticsLog(message) } @OptIn(UnsafeNumber::class) override fun sendHandledException(throwable: Throwable) { - val exceptionClassName = throwable::class.qualifiedName - val exModel = FIRExceptionModel.exceptionModelWithName(exceptionClassName, throwable.message)!! - exModel.setStackTrace(throwable.getFilteredStackTraceAddresses().map { FIRStackFrame.stackFrameWithAddress(it.convert()) }) - FIRCrashlytics.crashlytics().recordExceptionModel(exModel) + val exceptionClassName = throwable::class.qualifiedName ?: throwable::class.simpleName ?: "kotlin.Throwable" + FIRCrashlyticsRecordHandledException(exceptionClassName, throwable.message ?: "", throwable.getFilteredStackTraceAddresses().map { + FIRStackFrameWithAddress(it.convert()) + }) } override fun sendFatalException(throwable: Throwable) { val exception = throwable.asNSException(true) // The recorded exception is persisted, so we can safely terminate afterwards. // https://github.com/firebase/firebase-ios-sdk/blob/82f163bd86566f83c5d7572a1c2c0024a04eb4dc/Crashlytics/Crashlytics/Handlers/FIRCLSException.mm#L227 - FIRCLSExceptionRecordNSException(exception) + tryFIRCLSExceptionRecordNSException(exception) } override fun setCustomValue(key: String, value: Any) { - FIRCrashlytics.crashlytics().setCustomValue(value, key) + FIRCrashlyticsSetCustomValue(key, value) } override fun setUserId(identifier: String) { - FIRCrashlytics.crashlytics().setUserID(identifier) + FIRCrashlyticsSetUserID(identifier) } -} \ No newline at end of file +} diff --git a/crashlytics/src/include/FIRCrashlytics.h b/crashlytics/src/include/FIRCrashlytics.h deleted file mode 100644 index 2cbae99..0000000 --- a/crashlytics/src/include/FIRCrashlytics.h +++ /dev/null @@ -1,31 +0,0 @@ -// The following are snippets from the Firebase Crashlytics iOS SDK used to generate Kotlin stubs. -// -// https://github.com/firebase/firebase-ios-sdk/blob/85781d0c7661af0bd5d11c5b00cf47e6a1c0adff/Crashlytics/Crashlytics/Public/FirebaseCrashlytics/FIRCrashlytics.h -// -// Copyright 2019-2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import -#import - -@interface FIRCrashlytics : NSObject - -+ (nonnull instancetype)crashlytics; -- (void)recordExceptionModel:(nonnull FIRExceptionModel *)exceptionModel; -- (void)log:(NSString *)msg; -- (void)setCustomValue:(nullable id)value forKey:(NSString *)key; -- (void)recordExceptionModel:(FIRExceptionModel *)exceptionModel - NS_SWIFT_NAME(record(exceptionModel:)); -- (void)setUserID:(nullable NSString *)userID; -@end diff --git a/crashlytics/src/include/FIRExceptionModel.h b/crashlytics/src/include/FIRExceptionModel.h deleted file mode 100644 index 0fb417a..0000000 --- a/crashlytics/src/include/FIRExceptionModel.h +++ /dev/null @@ -1,29 +0,0 @@ -// The following are snippets from the Firebase Crashlytics iOS SDK used to generate Kotlin stubs. -// -// https://github.com/firebase/firebase-ios-sdk/blob/61dfd02e33e8264b8604b3ada2ff8c26fc218439/Crashlytics/Crashlytics/Public/FirebaseCrashlytics/FIRExceptionModel.h -// -// Copyright 2019-2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import -#import - -@interface FIRExceptionModel : NSObject - -- (nonnull instancetype)initWithName:(nonnull NSString *)name reason:(nonnull NSString *)reason; -+ (instancetype)exceptionModelWithName:(NSString *)name - reason:(NSString *)reason NS_SWIFT_UNAVAILABLE(""); -@property(nonatomic, copy) NSArray *_Nonnull stackTrace; - -@end diff --git a/crashlytics/src/include/FIRStackFrame.h b/crashlytics/src/include/FIRStackFrame.h deleted file mode 100644 index 68e26d2..0000000 --- a/crashlytics/src/include/FIRStackFrame.h +++ /dev/null @@ -1,25 +0,0 @@ -// The following are snippets from the Firebase Crashlytics iOS SDK used to generate Kotlin stubs. -// -// https://github.com/firebase/firebase-ios-sdk/blob/61dfd02e33e8264b8604b3ada2ff8c26fc218439/Crashlytics/Crashlytics/Public/FirebaseCrashlytics/FIRStackFrame.h -// -// Copyright 2019-2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import - -@interface FIRStackFrame : NSObject - -+ (nonnull instancetype)stackFrameWithAddress:(NSUInteger)address; - -@end diff --git a/crashlytics/src/include/Private/FIRCLSException.h b/crashlytics/src/include/Private/FIRCLSException.h deleted file mode 100644 index 7f861f4..0000000 --- a/crashlytics/src/include/Private/FIRCLSException.h +++ /dev/null @@ -1,21 +0,0 @@ -// The following are snippets from the Firebase Crashlytics iOS SDK used to generate Kotlin stubs. -// -// https://github.com/firebase/firebase-ios-sdk/blob/61dfd02e33e8264b8604b3ada2ff8c26fc218439/Crashlytics/Crashlytics/Handlers/FIRCLSException.h -// -// Copyright 2019-2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import - -extern void FIRCLSExceptionRecordNSException(NSException *exception); diff --git a/crashlytics/src/nativeInterop/cinterop/crashlytics.def b/crashlytics/src/nativeInterop/cinterop/crashlytics.def index 332c558..5391ae4 100644 --- a/crashlytics/src/nativeInterop/cinterop/crashlytics.def +++ b/crashlytics/src/nativeInterop/cinterop/crashlytics.def @@ -1,3 +1,122 @@ package = co.touchlab.crashkios.crashlytics language = Objective-C -headers = FIRCrashlytics.h FIRExceptionModel.h FIRStackFrame.h Private/FIRCLSException.h + +--- + +#import + +extern void FIRCLSExceptionRecordNSException(NSException *exception) __attribute__((weak)); + +void tryFIRCLSExceptionRecordNSException(NSException *exception) { + if (FIRCLSExceptionRecordNSException) { + FIRCLSExceptionRecordNSException(exception); + } else { + @throw [NSException + exceptionWithName:@"FIRFunctionNotFound" + reason:@"Function 'FIRCLSExceptionRecordNSException' not available, make sure you're adding the Firebase Crashlytics dependency." + userInfo: nil + ]; + } +} + +#define LoadClass(name)\ + static Class objClass;\ + if (!objClass) {\ + objClass = NSClassFromString(@OS_STRINGIFY(name));\ + if (!objClass) {\ + @throw [NSException\ + exceptionWithName:@"FIRClassNotFound"\ + reason: [NSString\ + stringWithFormat:@"Class '%@' not available, make sure you're adding the Firebase Crashlytics dependency.",\ + @OS_STRINGIFY(name)\ + ]\ + userInfo: nil\ + ];\ + }\ + } + +void* FIRMethodForSelector(id _Nonnull target, SEL _Nonnull selector) { + IMP method = [target methodForSelector:selector]; + if (!method) { + @throw [NSException + exceptionWithName:@"FIRMethodNotFound" + reason: [NSString + stringWithFormat:@"Target '%@' returned nil method for selector '%@'. This is probably a bug in CrashKiOS", + target, + NSStringFromSelector(selector) + ] + userInfo: nil + ]; + } else { + return method; + } +} + +id FIRExceptionModelWithNameAndReason(NSString* _Nonnull name, NSString* _Nonnull reason) { + LoadClass(FIRExceptionModel); + SEL selector = NSSelectorFromString(@"exceptionModelWithName:reason:"); + id (*exceptionModelWithNameAndReason)(id, SEL, NSString*, NSString*) = FIRMethodForSelector(objClass, selector); + return exceptionModelWithNameAndReason(objClass, selector, name, reason); +} + +void FIRExceptionModelSetStackTrace(id exceptionModel, NSArray* _Nonnull stackFrames) { + SEL selector = NSSelectorFromString(@"setStackTrace:"); + void (*setStackTrace)(id, SEL, NSArray*) = FIRMethodForSelector(exceptionModel, selector); + setStackTrace(exceptionModel, selector, stackFrames); +} + +id FIRStackFrameWithAddress(NSUInteger address) { + LoadClass(FIRStackFrame); + SEL selector = NSSelectorFromString(@"stackFrameWithAddress:"); + id (*stackFrameWithAddress)(id, SEL, NSUInteger) = FIRMethodForSelector(objClass, selector); + return stackFrameWithAddress(objClass, selector, address); +} + +id FIRCrashlyticsInstance(void) { + LoadClass(FIRCrashlytics); + SEL selector = NSSelectorFromString(@"crashlytics"); + id (*crashlytics)(id, SEL) = FIRMethodForSelector(objClass, selector); + id instance = crashlytics(objClass, selector); + if (instance) { + return instance; + } else { + @throw [NSException + exceptionWithName:@"FIRCrashlyticsNil" + reason: @"[FirCrashlytics crashlytics] returned nil. Make sure you initialize Firebase before using it." + userInfo: nil + ]; + } +} + +void FIRCrashlyticsRecordExceptionModel(id crashlytics, id exceptionModel) { + SEL selector = NSSelectorFromString(@"recordExceptionModel:"); + void (*recordExceptionModel)(id, SEL, id) = FIRMethodForSelector(crashlytics, selector); + recordExceptionModel(crashlytics, selector, exceptionModel); +} + +void FIRCrashlyticsRecordHandledException(NSString* _Nonnull name, NSString* _Nonnull reason, NSArray* _Nonnull stackFrames) { + id exceptionModel = FIRExceptionModelWithNameAndReason(name, reason); + FIRExceptionModelSetStackTrace(exceptionModel, stackFrames); + FIRCrashlyticsRecordExceptionModel(FIRCrashlyticsInstance(), exceptionModel); +} + +void FIRCrashlyticsLog(NSString* _Nonnull message) { + id crashlytics = FIRCrashlyticsInstance(); + SEL selector = NSSelectorFromString(@"log:"); + void (*log)(id, SEL, NSString* _Nonnull) = FIRMethodForSelector(crashlytics, selector); + log(crashlytics, selector, message); +} + +void FIRCrashlyticsSetUserID(NSString* _Nonnull identifier) { + id crashlytics = FIRCrashlyticsInstance(); + SEL selector = NSSelectorFromString(@"setUserID:"); + void (*setUserID)(id, SEL, NSString* _Nonnull) = FIRMethodForSelector(crashlytics, selector); + setUserID(crashlytics, selector, identifier); +} + +void FIRCrashlyticsSetCustomValue(NSString* _Nonnull key, id __nullable value) { + id crashlytics = FIRCrashlyticsInstance(); + SEL selector = NSSelectorFromString(@"setCustomValue:forKey:"); + void (*setCustomValueForKey)(id, SEL, id __nullable, NSString* _Nonnull) = FIRMethodForSelector(crashlytics, selector); + setCustomValueForKey(crashlytics, selector, value, key); +} diff --git a/samples/sample-crashlytics/gradle/wrapper/gradle-wrapper.properties b/samples/sample-crashlytics/gradle/wrapper/gradle-wrapper.properties index 15de902..e411586 100644 --- a/samples/sample-crashlytics/gradle/wrapper/gradle-wrapper.properties +++ b/samples/sample-crashlytics/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/sample-crashlytics/ios-spm/.gitignore b/samples/sample-crashlytics/ios-spm/.gitignore new file mode 100644 index 0000000..508139c --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/.gitignore @@ -0,0 +1,138 @@ +# Created by https://www.gitignore.io/api/xcode,swift,objective-c +# Edit at https://www.gitignore.io/?templates=xcode,swift,objective-c + +### Objective-C ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +# CocoaPods +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# Pods/ +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ + +### Objective-C Patch ### + +### Swift ### +# Xcode +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + + + + + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +.build/ +# Add this line if you want to avoid checking in Xcode SPM integration. +# .swiftpm/xcode + +# CocoaPods +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# Pods/ +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + + +# Accio dependency management +Dependencies/ +.accio/ + +# fastlane +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + + +# Code Injection +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + + +### Xcode ### +# Xcode +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) + +## Xcode Patch +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno + +### Xcode Patch ### +**/xcshareddata/WorkspaceSettings.xcsettings + +# End of https://www.gitignore.io/api/xcode,swift,objective-c \ No newline at end of file diff --git a/samples/sample-crashlytics/ios-spm/ios.xcodeproj/project.pbxproj b/samples/sample-crashlytics/ios-spm/ios.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5228e7f --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios.xcodeproj/project.pbxproj @@ -0,0 +1,455 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 60; + objects = { + +/* Begin PBXBuildFile section */ + 1814D0362C2C8B2A00C93985 /* CrashlyticsCallsActual.kt in Resources */ = {isa = PBXBuildFile; fileRef = 1814D0352C2C8B2A00C93985 /* CrashlyticsCallsActual.kt */; }; + 1814D0382C2C95A400C93985 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 1814D0372C2C95A400C93985 /* FirebaseCrashlytics */; }; + 6381FF9E277D0BE900EF27B0 /* iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6381FF9D277D0BE900EF27B0 /* iosApp.swift */; }; + 6381FFA0277D0BE900EF27B0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6381FF9F277D0BE900EF27B0 /* ContentView.swift */; }; + 6381FFA2277D0BEC00EF27B0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6381FFA1277D0BEC00EF27B0 /* Assets.xcassets */; }; + 6381FFA5277D0BEC00EF27B0 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6381FFA4277D0BEC00EF27B0 /* Preview Assets.xcassets */; }; + 6381FFAE277D0E1200EF27B0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6381FFAC277D0E1200EF27B0 /* AppDelegate.swift */; }; + A30FA4F028DB17F400E4D5A3 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = A30FA4EF28DB17F400E4D5A3 /* GoogleService-Info.plist */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 091D28CBC7DE88C8F19D392C /* Pods_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1814D0352C2C8B2A00C93985 /* CrashlyticsCallsActual.kt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CrashlyticsCallsActual.kt; path = ../../../crashlytics/src/appleMain/kotlin/co/touchlab/crashkios/crashlytics/CrashlyticsCallsActual.kt; sourceTree = ""; }; + 6381FF9A277D0BE900EF27B0 /* ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ios.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 6381FF9D277D0BE900EF27B0 /* iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosApp.swift; sourceTree = ""; }; + 6381FF9F277D0BE900EF27B0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 6381FFA1277D0BEC00EF27B0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 6381FFA4277D0BEC00EF27B0 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 6381FFAC277D0E1200EF27B0 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A30FA4EF28DB17F400E4D5A3 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6381FF97277D0BE900EF27B0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1814D0382C2C95A400C93985 /* FirebaseCrashlytics in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 49A71BEE2A96A888E85A2092 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 091D28CBC7DE88C8F19D392C /* Pods_ios.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 6381FF91277D0BE900EF27B0 = { + isa = PBXGroup; + children = ( + 1814D0352C2C8B2A00C93985 /* CrashlyticsCallsActual.kt */, + 6381FF9C277D0BE900EF27B0 /* ios */, + 6381FF9B277D0BE900EF27B0 /* Products */, + 49A71BEE2A96A888E85A2092 /* Frameworks */, + ); + sourceTree = ""; + }; + 6381FF9B277D0BE900EF27B0 /* Products */ = { + isa = PBXGroup; + children = ( + 6381FF9A277D0BE900EF27B0 /* ios.app */, + ); + name = Products; + sourceTree = ""; + }; + 6381FF9C277D0BE900EF27B0 /* ios */ = { + isa = PBXGroup; + children = ( + 6381FFAC277D0E1200EF27B0 /* AppDelegate.swift */, + A30FA4EF28DB17F400E4D5A3 /* GoogleService-Info.plist */, + 6381FF9D277D0BE900EF27B0 /* iosApp.swift */, + 6381FF9F277D0BE900EF27B0 /* ContentView.swift */, + 6381FFA1277D0BEC00EF27B0 /* Assets.xcassets */, + 6381FFA3277D0BEC00EF27B0 /* Preview Content */, + ); + path = ios; + sourceTree = ""; + }; + 6381FFA3277D0BEC00EF27B0 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 6381FFA4277D0BEC00EF27B0 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6381FF99277D0BE900EF27B0 /* ios */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6381FFA8277D0BEC00EF27B0 /* Build configuration list for PBXNativeTarget "ios" */; + buildPhases = ( + 1814D0342C2C5BE600C93985 /* Embed KMP */, + 6381FF96277D0BE900EF27B0 /* Sources */, + 6381FF97277D0BE900EF27B0 /* Frameworks */, + 6381FF98277D0BE900EF27B0 /* Resources */, + 6381FFAF277D0F0500EF27B0 /* Upload symbols to Crashlytics */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ios; + packageProductDependencies = ( + 1814D0372C2C95A400C93985 /* FirebaseCrashlytics */, + ); + productName = ios; + productReference = 6381FF9A277D0BE900EF27B0 /* ios.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6381FF92277D0BE900EF27B0 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1300; + LastUpgradeCheck = 1300; + TargetAttributes = { + 6381FF99277D0BE900EF27B0 = { + CreatedOnToolsVersion = 13.0; + }; + }; + }; + buildConfigurationList = 6381FF95277D0BE900EF27B0 /* Build configuration list for PBXProject "ios" */; + compatibilityVersion = "Xcode 15.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6381FF91277D0BE900EF27B0; + packageReferences = ( + 1814D0312C2C5B6D00C93985 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, + ); + productRefGroup = 6381FF9B277D0BE900EF27B0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6381FF99277D0BE900EF27B0 /* ios */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6381FF98277D0BE900EF27B0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1814D0362C2C8B2A00C93985 /* CrashlyticsCallsActual.kt in Resources */, + 6381FFA5277D0BEC00EF27B0 /* Preview Assets.xcassets in Resources */, + 6381FFA2277D0BEC00EF27B0 /* Assets.xcassets in Resources */, + A30FA4F028DB17F400E4D5A3 /* GoogleService-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 1814D0342C2C5BE600C93985 /* Embed KMP */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Embed KMP"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n"; + }; + 6381FFAF277D0F0500EF27B0 /* Upload symbols to Crashlytics */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}", + "$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)", + ); + name = "Upload symbols to Crashlytics"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6381FF96277D0BE900EF27B0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6381FFAE277D0E1200EF27B0 /* AppDelegate.swift in Sources */, + 6381FFA0277D0BE900EF27B0 /* ContentView.swift in Sources */, + 6381FF9E277D0BE900EF27B0 /* iosApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 6381FFA6277D0BEC00EF27B0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 6381FFA7277D0BEC00EF27B0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6381FFA9277D0BEC00EF27B0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 00101; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEPLOYMENT_POSTPROCESSING = YES; + DEVELOPMENT_ASSET_PATHS = "\"ios/Preview Content\""; + DEVELOPMENT_TEAM = 8UD86646U9; + ENABLE_BITCODE = NO; + ENABLE_PREVIEWS = YES; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 2.1.1; + OTHER_LDFLAGS = ( + "-framework", + shared, + ); + PRODUCT_BUNDLE_IDENTIFIER = co.touchlab.crashkios.sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6381FFAA277D0BEC00EF27B0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 00101; + DEPLOYMENT_POSTPROCESSING = YES; + DEVELOPMENT_ASSET_PATHS = "\"ios/Preview Content\""; + DEVELOPMENT_TEAM = 8UD86646U9; + ENABLE_BITCODE = NO; + ENABLE_PREVIEWS = YES; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 2.1.1; + OTHER_LDFLAGS = ( + "-framework", + shared, + ); + PRODUCT_BUNDLE_IDENTIFIER = co.touchlab.crashkios.sample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6381FF95277D0BE900EF27B0 /* Build configuration list for PBXProject "ios" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6381FFA6277D0BEC00EF27B0 /* Debug */, + 6381FFA7277D0BEC00EF27B0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6381FFA8277D0BEC00EF27B0 /* Build configuration list for PBXNativeTarget "ios" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6381FFA9277D0BEC00EF27B0 /* Debug */, + 6381FFAA277D0BEC00EF27B0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 1814D0312C2C5B6D00C93985 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 10.28.1; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 1814D0372C2C95A400C93985 /* FirebaseCrashlytics */ = { + isa = XCSwiftPackageProductDependency; + package = 1814D0312C2C5B6D00C93985 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseCrashlytics; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 6381FF92277D0BE900EF27B0 /* Project object */; +} diff --git a/samples/sample-crashlytics/ios-spm/ios.xcodeproj/xcshareddata/xcschemes/ios.xcscheme b/samples/sample-crashlytics/ios-spm/ios.xcodeproj/xcshareddata/xcschemes/ios.xcscheme new file mode 100644 index 0000000..a1c3c1d --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios.xcodeproj/xcshareddata/xcschemes/ios.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/sample-crashlytics/ios-spm/ios/AppDelegate.swift b/samples/sample-crashlytics/ios-spm/ios/AppDelegate.swift new file mode 100644 index 0000000..586ba34 --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/AppDelegate.swift @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Touchlab +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +import UIKit +import shared +import Firebase + +class AppDelegate: NSObject, UIApplicationDelegate { + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + FirebaseApp.configure() + HelperKt.startCrashKiOS() + + return true + } +} diff --git a/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/AccentColor.colorset/Contents.json b/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/AppIcon.appiconset/Contents.json b/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/Contents.json b/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/samples/sample-crashlytics/ios-spm/ios/ContentView.swift b/samples/sample-crashlytics/ios-spm/ios/ContentView.swift new file mode 100644 index 0000000..5727b7a --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/ContentView.swift @@ -0,0 +1,76 @@ +// +// ContentView.swift +// ios +// +// Created by Kevin Galligan on 12/29/21. +// + +import SwiftUI +import shared + +struct ContentView: View { + + let common: SampleCommon + let cb = CrashBot() + + init() { + self.common = SampleCommon() + } + + var body: some View { + VStack(spacing: 50){ + Button(action: { + self.common.setUserId(identifier: "123") + }){ + Text("Set User Id").padding() + .background(Color.blue) + .foregroundColor(.white) + .font(.title) + } + Button(action: { + self.common.onClick() + }){ + Text("Click Count").padding() + .background(Color.blue) + .foregroundColor(.white) + .font(.title) + } + Button(action: { + self.common.logException() + }){ + Text("Log Exception").padding() + .background(Color.blue) + .foregroundColor(.white) + .font(.title) + } + Button(action: { + self.cb.goCrash() + }){ + Text("Kotlin Crash").padding() + .background(Color.blue) + .foregroundColor(.white) + .font(.title) + } + + Button(action: { + realCrash() + }){ + Text("Swift Crash").padding() + .background(Color.blue) + .foregroundColor(.white) + .font(.title) + } + } + } +} + +func realCrash() { + let numbers = [0] + let _ = numbers[1] +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/samples/sample-crashlytics/ios-spm/ios/GoogleService-Info.plist b/samples/sample-crashlytics/ios-spm/ios/GoogleService-Info.plist new file mode 100644 index 0000000..70889c6 --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/GoogleService-Info.plist @@ -0,0 +1,30 @@ + + + + + API_KEY + AIzaSyAEDOEwsd0-F3kg5QbOGqc9fNPsF5Ergbs + GCM_SENDER_ID + 262996390724 + PLIST_VERSION + 1 + BUNDLE_ID + co.touchlab.crashkios.sample + PROJECT_ID + crashkiossample + STORAGE_BUCKET + crashkiossample.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:262996390724:ios:7a848afa4b4ca8448add11 + + \ No newline at end of file diff --git a/samples/sample-crashlytics/ios-spm/ios/Preview Content/Preview Assets.xcassets/Contents.json b/samples/sample-crashlytics/ios-spm/ios/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/samples/sample-crashlytics/ios-spm/ios/iosApp.swift b/samples/sample-crashlytics/ios-spm/ios/iosApp.swift new file mode 100644 index 0000000..2ec196b --- /dev/null +++ b/samples/sample-crashlytics/ios-spm/ios/iosApp.swift @@ -0,0 +1,20 @@ +// +// iosApp.swift +// ios +// +// Created by Kevin Galligan on 12/29/21. +// + +import SwiftUI + +@main +struct iosApp: App { + + @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate + + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/samples/sample-crashlytics/settings.gradle.kts b/samples/sample-crashlytics/settings.gradle.kts index 7e98d40..d108bbb 100644 --- a/samples/sample-crashlytics/settings.gradle.kts +++ b/samples/sample-crashlytics/settings.gradle.kts @@ -22,6 +22,8 @@ includeBuild("../..") { dependencySubstitution { substitute(module("co.touchlab.crashkios:crashlytics")) .using(project(":crashlytics")).because("we want to auto-wire up sample dependency") + substitute(module("co.touchlab.crashkios.crashlyticslink:co.touchlab.crashkios.crashlyticslink.gradle.plugin")) + .using(project(":crashlytics-ios-link")).because("we want to auto-wire up sample dependency") } } @@ -32,4 +34,4 @@ pluginManagement { mavenCentral() maven("https://oss.sonatype.org/content/repositories/snapshots") } -} \ No newline at end of file +}