Skip to content

Commit 651dafb

Browse files
authored
fix: ios crash on launch (#114)
* fix: rpath for bugsplat on ios * fix: sign BugSplat.framework * fix: iOS capitalization issue Fixes #109
1 parent d16a78f commit 651dafb

File tree

77 files changed

+5075
-3058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5075
-3058
lines changed

Source/BugSplatRuntime/BugSplatRuntime.Build.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public BugSplatRuntime(ReadOnlyTargetRules Target) : base(Target)
6767
string FrameworkPath = Path.Combine(ModuleDirectory, "../ThirdParty/IOS");
6868

6969
// Add the framework (unzipped from .embeddedframework.zip by UPL)
70-
PublicAdditionalFrameworks.Add(new Framework("BugSplat", Path.Combine(FrameworkPath, "BugSplat.embeddedframework.zip"), ""));
70+
PublicAdditionalFrameworks.Add(new Framework("BugSplat", Path.Combine(FrameworkPath, "BugSplat.embeddedframework.zip"), "", true));
71+
PublicAdditionalFrameworks.Add(new Framework("HockeySDK", Path.Combine(FrameworkPath, "HockeySDK.embeddedframework.zip"), "", true));
7172

7273
// Add the framework's Headers directory to the include path
7374
PublicIncludePaths.Add(Path.Combine(FrameworkPath, "BugSplat.framework/Headers"));

Source/BugSplatRuntime/BugSplat_IOS_UPL.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<init>
44
<log text="BugSplat SDK iOS UPL initialization"/>
55
<copyDir src="$S(PluginDir)/../ThirdParty/IOS/BugSplat.framework" dst="$S(BuildDir)/Frameworks/BugSplat.framework" />
6+
<copyDir src="$S(PluginDir)/../ThirdParty/IOS/HockeySDK.framework" dst="$S(BuildDir)/Frameworks/HockeySDK.framework" />
67

78
<setBoolFromProperty result="bEnableCrashReporting" ini="Engine" section="/Script/BugSplatRuntime.BugSplatEditorSettings" property="bEnableCrashReportingIos" default="true" />
89
<setBoolFromProperty result="bUploadSymbols" ini="Engine" section="/Script/BugSplatRuntime.BugSplatEditorSettings" property="bUploadDebugSymbols" default="true" />
31.8 KB
Binary file not shown.
114 KB
Binary file not shown.

Source/ThirdParty/IOS/Bugsplat.framework/Headers/BugSplatDelegate.h renamed to Source/ThirdParty/IOS/BugSplat.framework/Headers/BugSplatDelegate.h

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,22 @@ NS_ASSUME_NONNULL_BEGIN
5959
*/
6060
-(void)bugSplatWillCancelSendingCrashReport:(BugSplat *)bugSplat;
6161

62+
/** Return a BugSplatAttachment object providing an NSData object the crash report being processed should contain
63+
NOTE: For iOS, if this method returns a non-nil BugSplatAttachment, any attributes added via setAttribute:value: to BugSplat will NOT be included in the Crash Report.
64+
65+
Example implementation:
66+
67+
NSData *data = [NSData dataWithContentsOfURL:@"mydatafile"];
68+
69+
BugSplatAttachment *attachment = [[BugSplatAttachment alloc] initWithFilename:@"myfile.data"
70+
attachmentData:data
71+
contentType:@"application/octet-stream"];
72+
@param bugSplat The `BugSplat` instance invoking this delegate
73+
*/
74+
- (BugSplatAttachment *)attachmentForBugSplat:(BugSplat *)bugSplat API_AVAILABLE(ios(13.0));
75+
6276
// MARK: - BugSplatDelegate (MacOS)
77+
#if TARGET_OS_OSX
6378

6479
/** Return any string based data the crash report being processed should contain
6580
*
@@ -85,27 +100,15 @@ NS_ASSUME_NONNULL_BEGIN
85100
- (NSArray<BugSplatAttachment *> *)attachmentsForBugSplat:(BugSplat *)bugSplat API_AVAILABLE(macosx(10.13));
86101

87102
// MARK: - BugSplatDelegate (iOS)
88-
89-
/** Return a BugSplatAttachment object providing an NSData object the crash report being processed should contain
90-
NOTE: If this method returns a non-nil BugSplatAttachment, any attributes added via setAttribute:value: to BugSplat will NOT be included in the Crash Report.
91-
92-
Example implementation:
93-
94-
NSData *data = [NSData dataWithContentsOfURL:@"mydatafile"];
95-
96-
BugSplatAttachment *attachment = [[BugSplatAttachment alloc] initWithFilename:@"myfile.data"
97-
attachmentData:data
98-
contentType:@"application/octet-stream"];
99-
@param bugSplat The `BugSplat` instance invoking this delegate
100-
*/
101-
- (BugSplatAttachment *)attachmentForBugSplat:(BugSplat *)bugSplat API_AVAILABLE(ios(13.0));
103+
#else
102104

103105
/** Invoked after the user did choose to send crashes always in the alert
104106
105107
@param bugSplat The `BugSplat` instance invoking this delegate
106108
*/
107109
-(void)bugSplatWillSendCrashReportsAlways:(BugSplat *)bugSplat API_AVAILABLE(ios(13.0));
108110

111+
#endif
109112

110113
@end
111114

Source/ThirdParty/IOS/Bugsplat.framework/Headers/Bugsplat.h renamed to Source/ThirdParty/IOS/BugSplat.framework/Headers/Bugsplat.h

Lines changed: 80 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,6 @@ NS_ASSUME_NONNULL_BEGIN
5454
*/
5555
@property (weak, nonatomic, nullable) id<BugSplatDelegate> delegate;
5656

57-
/** Set the userID that should used in the SDK components
58-
59-
Right now this is used by the Crash Manager to attach to a crash report.
60-
61-
The value can be set at any time and will be stored in the keychain on the current
62-
device only! To delete the value from the keychain set the value to `nil`.
63-
64-
This property is optional.
65-
66-
@warning When returning a non nil value, crash reports are not anonymous any more
67-
and the crash alerts will not show the word "anonymous"!
68-
69-
@warning This property needs to be set before calling `start` to be considered
70-
for being added to crash reports as meta data.
71-
72-
@see userName
73-
@see userEmail
74-
@see `[BITHockeyManagerDelegate userIDForHockeyManager:componentManager:]`
75-
*/
76-
@property (nonatomic, copy, nullable) NSString *userID;
77-
7857
/**
7958
* The database name BugSplat will use to construct the BugSplatDatabase URL where crash reports will be submitted.
8059
*
@@ -95,45 +74,60 @@ NS_ASSUME_NONNULL_BEGIN
9574
*/
9675
@property (nonatomic, copy, nullable) NSString *bugSplatDatabase;
9776

98-
/** Set the user name that should used in the SDK components
99-
100-
Right now this is used by the Crash Manager to attach to a crash report.
101-
102-
The value can be set at any time and will be stored in the keychain on the current
103-
device only! To delete the value from the keychain set the value to `nil`.
104-
105-
This property is optional.
106-
107-
@warning When returning a non nil value, crash reports are not anonymous any more
108-
and the crash alerts will not show the word "anonymous"!
109-
110-
@warning This property needs to be set before calling `start` to be considered
111-
for being added to crash reports as meta data.
77+
/**
78+
* The userID that will be used when a crash report is submitted.
79+
*
80+
* The value can be set programmatically at any time and will be stored in NSUserDefaults.
81+
* To delete the value from NSUserDefaults, set the value to `nil`.
82+
*
83+
* This property is optional.
84+
*
85+
* @warning When returning a non nil value, crash reports are not anonymous any more
86+
* and the crash alerts will not show the word "anonymous"!
87+
*
88+
* @warning If setting this property programmatically, it needs to be set before calling `start`
89+
* if the userID should be included in a possible crash from the last app session.
90+
*
91+
* @see userName
92+
* @see userEmail
93+
*/
94+
@property (nonatomic, copy, nullable) NSString *userID;
11295

113-
@see userID
114-
@see userEmail
115-
@see `[BITHockeyManagerDelegate userNameForHockeyManager:componentManager:]`
96+
/**
97+
* The user name that will be used when a crash report is submitted.
98+
*
99+
* The value can be set programmatically at any time and will be stored in NSUserDefaults.
100+
* To delete the value from NSUserDefaults, set the value to `nil`.
101+
*
102+
* This property is optional.
103+
*
104+
* @warning When returning a non nil value, crash reports are not anonymous any more
105+
* and the crash alerts will not show the word "anonymous"!
106+
*
107+
* @warning If setting this property programmatically, it needs to be set before calling `start`
108+
* if the userName should be included in a possible crash from the last app session.
109+
*
110+
* @see userID
111+
* @see userEmail
116112
*/
117113
@property (nonatomic, copy, nullable) NSString *userName;
118114

119-
/** Set the users email address that should used in the SDK components
120-
121-
Right now this is used by the Crash Manager to attach to a crash report.
122-
123-
The value can be set at any time and will be stored in the keychain on the current
124-
device only! To delete the value from the keychain set the value to `nil`.
125-
126-
This property is optional.
127-
128-
@warning When returning a non nil value, crash reports are not anonymous any more
129-
and the crash alerts will not show the word "anonymous"!
130-
131-
@warning This property needs to be set before calling `start` to be considered
132-
for being added to crash reports as meta data.
133-
134-
@see userID
135-
@see userName
136-
@see [BITHockeyManagerDelegate userEmailForHockeyManager:componentManager:]
115+
/**
116+
* The user email address that will be used when a crash report is submitted.
117+
*
118+
* The value can be set programmatically at any time and will be stored in NSUserDefaults.
119+
* To delete the value from NSUserDefaults, set the value to `nil`.
120+
*
121+
* This property is optional.
122+
*
123+
* @warning When returning a non nil value, crash reports are not anonymous any more
124+
* and the crash alerts will not show the word "anonymous"!
125+
*
126+
* @warning If setting this property programmatically, it needs to be set before calling `start`
127+
* if the userEmail should be included in a possible crash from the last app session.
128+
*
129+
* @see userID
130+
* @see userName
137131
*/
138132
@property (nonatomic, copy, nullable) NSString *userEmail;
139133

@@ -148,8 +142,11 @@ NS_ASSUME_NONNULL_BEGIN
148142
@property (nonatomic, assign) BOOL autoSubmitCrashReport;
149143

150144
/**
151-
* Add an attribute and value to the crash report.
152-
* Attributes and values represent app supplied keys and values to associate with a crash report.
145+
* Add an attribute and value to a dictionary of attributes that will potentially be included in a crash report.
146+
* If the attribute is an invalid XML entity name, or the attribute+value pair cannot be set,
147+
* the method will return NO, otherwise it will return YES.
148+
*
149+
* Attributes and values represent app supplied keys and values to associate with a crash report, should the app crash during this session.
153150
* Attributes and values will be bundled up in a BugSplatAttachment as NSData, with a filename of CrashContext.xml, MIME type of "application/xml" and encoding of "UTF-8".
154151
*
155152
* IMPORTANT: For iOS, only one BugSplatAttachment is currently supported.
@@ -159,28 +156,34 @@ NS_ASSUME_NONNULL_BEGIN
159156
* NOTES:
160157
*
161158
* This method may be called multiple times, once per attribute+value pair.
162-
* Attributes are backed by an NSDictionary so attribute names must be unique.
159+
* This method may be called at any time during the app session prior to a crash.
160+
* Attributes are persisted to NSUserDefaults within a NSDictionary<NSString *, NSString *>, so attribute names must be unique.
163161
* If the attribute does not exist, it will be added to attributes dictionary.
164162
* If attribute already exists, the value will be replaced in the dictionary.
165163
* If attribute already exists, and the value is nil, the attribute will be removed from the dictionary.
166164
*
167165
* When this method is called, the following preprocessing occurs:
168-
* 1. attribute will first have white space and newlines removed from both the beginning and end of the String.
166+
* 1. attribute will be checked for XML entity name rules. If validation fails, method returns NO.
169167
*
170-
* 2. attribute will then be processed by an XML escaping routine which looks for escapable characters ",',&,<, and >
168+
* 2. values will then be processed by an XML escaping routine which looks for escapable characters ",',&,<, and >
171169
* See: https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents
172170
* Any XML comment blocks or CDATA blocks found will disable XML escaping within the block.
173171
*
174-
* 3. values will then be processed by an XML escaping routine which looks for escapable characters ",',&,<, and >
175-
* Any XML comment blocks or CDATA blocks found will disable XML escaping within the block.
172+
* 3. After processing both attribute and value for XML escape characters, the attribute+value pair will be
173+
* persisted to NSUserDefaults within a NSDictionary<NSString *, NSString *>.
176174
*
177-
* 4. After processing both attribute and value for XML escape characters, the attribute+value pair will be stored in an NSDictionary.
175+
* 4. If the attribute or value cannot be set, the method will return NO, otherwise it will return YES.
178176
*
179177
* If a crash occurs, attributes and values will be bundled up in a BugSplatAttachment as NSData, with a filename of CrashContext.xml, MIME type of "application/xml"
180178
* and encoding of "UTF-8". The attachment will be included with the crash data (except as noted above regarding iOS BugSplatAttachment limitation).
181-
*
179+
*
180+
* Attributes and their values are only valid for the lifetime of the app session and only used in a crash report if the crash occurs during that app session.
181+
* Any attributes set in the prior app session will be bundled up in a BugSplatAttachment as NSData, with a filename of CrashContext.xml,
182+
* MIME type of "application/xml" and encoding of "UTF-8". The attachment will be added to the crash report when it is processed during the next launch of the app.
183+
* If the app terminates normally, any attributes persisted during the prior `normal` app session will be erased during the next app launch.
184+
*
182185
*/
183-
- (void)setValue:(nullable NSString *)value forAttribute:(NSString *)attribute;
186+
- (BOOL)setValue:(nullable NSString *)value forAttribute:(NSString *)attribute NS_SWIFT_NAME(set(_:for:));
184187

185188
// macOS specific API
186189
#if TARGET_OS_OSX
@@ -198,9 +201,18 @@ NS_ASSUME_NONNULL_BEGIN
198201
@property (nonatomic, assign) BOOL askUserDetails;
199202

200203
/**
201-
* Defines if user's name and email entered in the crash report UI should be saved to the keychain.
204+
* If the user enters their name or email on a Bug Crash Alert Form, persist their data to NSUserDefaults.
205+
* After this occurs, userName and userEmail properties will contain the values the user entered.
206+
* When the Bug Crash Alert Form is presented again, it will be pre-populated with user name and email.
207+
* To erase their user name or email, set the property value to nil programmatically.
208+
*
209+
* This property defaults to NO.
210+
* This property is optional.
211+
*
212+
* @warning If setting this property to YES, it needs to be set before calling `start`.
202213
*
203-
* Default: _NO_
214+
* @see userName
215+
* @see userEmail
204216
*/
205217
@property (nonatomic, assign) BOOL persistUserDetails;
206218

Source/ThirdParty/IOS/Bugsplat.framework/Headers/BugsplatAttachment.h renamed to Source/ThirdParty/IOS/BugSplat.framework/Headers/BugsplatAttachment.h

File renamed without changes.
751 Bytes
Binary file not shown.

Source/ThirdParty/IOS/Bugsplat.framework/Modules/module.modulemap renamed to Source/ThirdParty/IOS/BugSplat.framework/Modules/module.modulemap

File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSPrivacyAccessedAPITypes</key>
6+
<array>
7+
<dict>
8+
<key>NSPrivacyAccessedAPIType</key>
9+
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
10+
<key>NSPrivacyAccessedAPITypeReasons</key>
11+
<array>
12+
<string>CA92.1</string>
13+
</array>
14+
</dict>
15+
</array>
16+
</dict>
17+
</plist>

0 commit comments

Comments
 (0)