Skip to content

Commit

Permalink
Added Crashalytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Knut Inge Grosland committed May 28, 2015
1 parent d7886ca commit a10a14a
Show file tree
Hide file tree
Showing 29 changed files with 887 additions and 1 deletion.
32 changes: 32 additions & 0 deletions App Reviews.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
49FD79D91B166B4D00E99F4B /* 3dPartyLicenses.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 49FD79D81B166B4D00E99F4B /* 3dPartyLicenses.rtf */; };
49FD79DB1B17248A00E99F4B /* LaunchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49FD79DA1B17248A00E99F4B /* LaunchViewController.swift */; };
49FD79DD1B17327500E99F4B /* NSUserDefaults+AppReviews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49FD79DC1B17327500E99F4B /* NSUserDefaults+AppReviews.swift */; };
49FD79E11B17CBF700E99F4B /* Fabric.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49FD79DF1B17CBF700E99F4B /* Fabric.framework */; };
49FD79E21B17CBF700E99F4B /* Crashlytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49FD79E01B17CBF700E99F4B /* Crashlytics.framework */; };
67821E35AE9AB2E4F46170D4 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5083B9909F1AD9259C461DBD /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -144,6 +146,8 @@
49FD79D81B166B4D00E99F4B /* 3dPartyLicenses.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = 3dPartyLicenses.rtf; sourceTree = "<group>"; };
49FD79DA1B17248A00E99F4B /* LaunchViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LaunchViewController.swift; path = AppReviews/LaunchViewController.swift; sourceTree = SOURCE_ROOT; };
49FD79DC1B17327500E99F4B /* NSUserDefaults+AppReviews.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSUserDefaults+AppReviews.swift"; path = "AppReviews/NSUserDefaults+AppReviews.swift"; sourceTree = SOURCE_ROOT; };
49FD79DF1B17CBF700E99F4B /* Fabric.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Fabric.framework; sourceTree = "<group>"; };
49FD79E01B17CBF700E99F4B /* Crashlytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Crashlytics.framework; sourceTree = "<group>"; };
5083B9909F1AD9259C461DBD /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8E9E3A98AF3DC476EF9A0809 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
F9CE0DF35CA051BD774393CD /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
Expand All @@ -155,6 +159,8 @@
buildActionMask = 2147483647;
files = (
67821E35AE9AB2E4F46170D4 /* Pods.framework in Frameworks */,
49FD79E21B17CBF700E99F4B /* Crashlytics.framework in Frameworks */,
49FD79E11B17CBF700E99F4B /* Fabric.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -353,6 +359,8 @@
7147F03F6DDA32E9CC0315BF /* Frameworks */ = {
isa = PBXGroup;
children = (
49FD79DF1B17CBF700E99F4B /* Fabric.framework */,
49FD79E01B17CBF700E99F4B /* Crashlytics.framework */,
5083B9909F1AD9259C461DBD /* Pods.framework */,
);
name = Frameworks;
Expand Down Expand Up @@ -381,6 +389,7 @@
9AFDC626376EE7DF95EFFC02 /* Embed Pods Frameworks */,
4190A1B1813032D096277609 /* Copy Pods Resources */,
49D09E541B0FF4C8006B39C9 /* Sign Sparkle */,
49FD79DE1B17CA4C00E99F4B /* Crashalytics */,
);
buildRules = (
);
Expand Down Expand Up @@ -545,6 +554,20 @@
shellPath = /bin/sh;
shellScript = "LOCATION=\"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\n\n# Usually set by Xcode\nCODE_SIGN_IDENTITY=\"Developer ID Application: Knut Inge Grosland\"\n\ncodesign --verbose --force --sign \"$CODE_SIGN_IDENTITY\" \"$LOCATION/Sparkle.framework/Versions/A\"";
};
49FD79DE1B17CA4C00E99F4B /* Crashalytics */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = Crashalytics;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "./Fabric.framework/run 975b8be9fe2f4dfd2f635a7b54ac52b4c49e023b cdb27eb87742e8cc0001dee929df20f6c8c18c09130ea5df80c17cfd68ae8a80";
};
72B401262D76AFCCD7B98C00 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -784,6 +807,11 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer: Knut Inge Grosland (BV7ZH22G55)";
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = AppReviews/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
ONLY_ACTIVE_ARCH = YES;
Expand All @@ -802,6 +830,10 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application: Knut Inge Grosland (2PRW676NCQ)";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = AppReviews/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "App Reviews";
Expand Down
8 changes: 7 additions & 1 deletion AppReviews/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import Cocoa
import AppKit
import SimpleCocoaAnalytics
import Fabric
import Crashlytics

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
Expand All @@ -23,7 +25,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// MARK: Application Process

func applicationDidFinishLaunching(aNotification: NSNotification) {


// Fabric CrashAlytics
Fabric.with([Crashlytics()])

// Google Analytics
var analyticsHelper = AnalyticsHelper.sharedInstance()
analyticsHelper.recordScreenWithName("Launch")
analyticsHelper.beginPeriodicReportingWithAccount("UA-62792522-3", name: "App Reviews OSX", version: NSApplication.v_versionBuild())
Expand Down
14 changes: 14 additions & 0 deletions AppReviews/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>7</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>975b8be9fe2f4dfd2f635a7b54ac52b4c49e023b</string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
</array>
</dict>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
1 change: 1 addition & 0 deletions Crashlytics.framework/Crashlytics
1 change: 1 addition & 0 deletions Crashlytics.framework/Headers
1 change: 1 addition & 0 deletions Crashlytics.framework/Modules
1 change: 1 addition & 0 deletions Crashlytics.framework/Resources
Binary file added Crashlytics.framework/Versions/A/Crashlytics
Binary file not shown.
62 changes: 62 additions & 0 deletions Crashlytics.framework/Versions/A/Headers/CLSLogging.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// CLSLogging.h
// Crashlytics
//
// Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
//

#import <Fabric/FABAttributes.h>
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif

FAB_START_NONNULL

/**
*
* The CLS_LOG macro provides as easy way to gather more information in your log messages that are
* sent with your crash data. CLS_LOG prepends your custom log message with the function name and
* line number where the macro was used. If your app was built with the DEBUG preprocessor macro
* defined CLS_LOG uses the CLSNSLog function which forwards your log message to NSLog and CLSLog.
* If the DEBUG preprocessor macro is not defined CLS_LOG uses CLSLog only.
*
* Example output:
* -[AppDelegate login:] line 134 $ login start
*
* If you would like to change this macro, create a new header file, unset our define and then define
* your own version. Make sure this new header file is imported after the Crashlytics header file.
*
* #undef CLS_LOG
* #define CLS_LOG(__FORMAT__, ...) CLSNSLog...
*
**/
#ifdef __OBJC__
#ifdef DEBUG
#define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
#endif

/**
*
* Add logging that will be sent with your crash data. This logging will not show up in the system.log
* and will only be visible in your Crashlytics dashboard.
*
**/

#ifdef __OBJC__
OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
OBJC_EXTERN void CLSLogv(NSString *format, va_list ap) NS_FORMAT_FUNCTION(1,0);

/**
*
* Add logging that will be sent with your crash data. This logging will show up in the system.log
* and your Crashlytics dashboard. It is not recommended for Release builds.
*
**/
OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
OBJC_EXTERN void CLSNSLogv(NSString *format, va_list ap) NS_FORMAT_FUNCTION(1,0);
#endif

FAB_END_NONNULL
103 changes: 103 additions & 0 deletions Crashlytics.framework/Versions/A/Headers/CLSReport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
//
// CLSReport.h
// Crashlytics
//
// Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Fabric/FABAttributes.h>

FAB_START_NONNULL

/**
* The CLSCrashReport protocol is deprecated. See the CLSReport class and the CrashyticsDelegate changes for details.
**/
@protocol CLSCrashReport <NSObject>

@property (nonatomic, copy, readonly) NSString *identifier;
@property (nonatomic, copy, readonly) NSDictionary *customKeys;
@property (nonatomic, copy, readonly) NSString *bundleVersion;
@property (nonatomic, copy, readonly) NSString *bundleShortVersionString;
@property (nonatomic, copy, readonly) NSDate *crashedOnDate;
@property (nonatomic, copy, readonly) NSString *OSVersion;
@property (nonatomic, copy, readonly) NSString *OSBuildVersion;

@end

/**
* The CLSReport exposes an interface to the phsyical report that Crashlytics has created. You can
* use this class to get information about the event, and can also set some values after the
* event has occured.
**/
@interface CLSReport : NSObject <CLSCrashReport>

- (instancetype)init NS_UNAVAILABLE;

/**
* Returns the session identifier for the report.
**/
@property (nonatomic, copy, readonly) NSString *identifier;

/**
* Returns the custom key value data for the report.
**/
@property (nonatomic, copy, readonly) NSDictionary *customKeys;

/**
* Returns the CFBundleVersion of the application that generated the report.
**/
@property (nonatomic, copy, readonly) NSString *bundleVersion;

/**
* Returns the CFBundleShortVersionString of the application that generated the report.
**/
@property (nonatomic, copy, readonly) NSString *bundleShortVersionString;

/**
* Returns the date that the report was created.
**/
@property (nonatomic, copy, readonly) NSDate *dateCreated;

/**
* Returns the os version that the application crashed on.
**/
@property (nonatomic, copy, readonly) NSString *OSVersion;

/**
* Returns the os build version that the application crashed on.
**/
@property (nonatomic, copy, readonly) NSString *OSBuildVersion;

/**
* Returns YES if the report contains any crash information. If the report
* contains only NSErrors, this will return NO.
**/
@property (nonatomic, assign, readonly) BOOL isCrash;

/**
* You can use this method to set, after the event, additional custom keys. The rules
* and semantics for this method are the same as those documented in Crashlytics.h. Be aware
* that the maximum size and count of custom keys is still enforced, and you can overwrite keys
* and/or cause excess keys to be deleted by using this method.
**/
- (void)setObjectValue:(id FAB_NULLABLE)value forKey:(NSString *)key;

/**
* Record an application-specific user identifier. See Crashlytics.h for details.
**/
@property (nonatomic, copy) NSString * FAB_NULLABLE userIdentifier;

/**
* Record a user name. See Crashlytics.h for details.
**/
@property (nonatomic, copy) NSString * FAB_NULLABLE userName;

/**
* Record a user email. See Crashlytics.h for details.
**/
@property (nonatomic, copy) NSString * FAB_NULLABLE userEmail;

@end

FAB_END_NONNULL
37 changes: 37 additions & 0 deletions Crashlytics.framework/Versions/A/Headers/CLSStackFrame.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// CLSStackFrame.h
// Crashlytics
//
// Copyright 2015 Crashlytics, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Fabric/FABAttributes.h>

FAB_START_NONNULL

/**
*
* This class is used in conjunction with -[Crashlytics recordCustomExceptionName:reason:frameArray:] to
* record information about non-ObjC/C++ exceptions. All information included here will be displayed
* in the Crashlytics UI, and can influence crash grouping. Be particularly careful with the use of the
* address property. If set, Crashlytics will attempt symbolication and could overwrite other properities
* in the process.
*
**/
@interface CLSStackFrame : NSObject

+ (instancetype)stackFrame;
+ (instancetype)stackFrameWithAddress:(NSUInteger)address;
+ (instancetype)stackFrameWithSymbol:(NSString *)symbol;

@property (nonatomic, copy) NSString * FAB_NULLABLE symbol;
@property (nonatomic, copy) NSString * FAB_NULLABLE library;
@property (nonatomic, copy) NSString * FAB_NULLABLE fileName;
@property (nonatomic, assign) uint32_t lineNumber;
@property (nonatomic, assign) uint64_t offset;
@property (nonatomic, assign) uint64_t address;

@end

FAB_END_NONNULL
Loading

0 comments on commit a10a14a

Please sign in to comment.