-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBugSplatUploadService.m
More file actions
568 lines (490 loc) · 24.8 KB
/
BugSplatUploadService.m
File metadata and controls
568 lines (490 loc) · 24.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
//
// BugSplatUploadService.m
//
// Copyright © BugSplat, LLC. All rights reserved.
//
#import "BugSplatUploadService.h"
#import "BugSplatZipHelper.h"
#import "BugSplatTestSupport.h"
NSString *const BugSplatUploadErrorDomain = @"com.bugsplat.upload";
typedef NS_ENUM(NSInteger, BugSplatUploadErrorCode) {
BugSplatUploadErrorCodeInvalidData = 1,
BugSplatUploadErrorCodeNetworkError = 2,
BugSplatUploadErrorCodeServerError = 3,
BugSplatUploadErrorCodeRateLimited = 4,
BugSplatUploadErrorCodeCancelled = 5
};
@implementation BugSplatCrashMetadata
@end
@interface BugSplatUploadService ()
@property (nonatomic, copy) NSString *database;
@property (nonatomic, copy) NSString *applicationName;
@property (nonatomic, copy) NSString *applicationVersion;
@property (nonatomic, strong) id<BugSplatURLSessionProtocol> urlSession;
@property (nonatomic, strong, nullable) NSURLSessionTask *currentTask;
@end
@implementation BugSplatUploadService
- (instancetype)initWithDatabase:(NSString *)database
applicationName:(NSString *)applicationName
applicationVersion:(NSString *)applicationVersion
{
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
config.timeoutIntervalForRequest = 60.0;
config.timeoutIntervalForResource = 300.0;
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
return [self initWithDatabase:database
applicationName:applicationName
applicationVersion:applicationVersion
urlSession:(id<BugSplatURLSessionProtocol>)session];
}
- (instancetype)initWithDatabase:(NSString *)database
applicationName:(NSString *)applicationName
applicationVersion:(NSString *)applicationVersion
urlSession:(id<BugSplatURLSessionProtocol>)urlSession
{
self = [super init];
if (self) {
_database = [database copy];
_applicationName = [applicationName copy];
_applicationVersion = [applicationVersion copy];
_urlSession = urlSession;
}
return self;
}
- (void)dealloc
{
[_urlSession invalidateAndCancel];
}
- (void)uploadCrashReport:(NSData *)crashData
crashFilename:(NSString *)crashFilename
attachments:(NSArray<BugSplatAttachment *> *)attachments
metadata:(BugSplatCrashMetadata *)metadata
completion:(BugSplatUploadCompletion)completion
{
// Defensive: ensure completion is not nil
if (!completion) {
NSLog(@"BugSplat: uploadCrashReport called with nil completion handler");
return;
}
@try {
if (!crashData || crashData.length == 0) {
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: @"Crash data is empty"}];
completion(NO, error, nil);
return;
}
// Use crash-time values from metadata, fall back to upload service defaults
NSString *database = metadata.database ?: self.database;
NSString *appName = metadata.applicationName ?: self.applicationName;
NSString *appVersion = metadata.applicationVersion ?: self.applicationVersion;
// Create ZIP archive with crash data and attachments
NSMutableArray<BugSplatZipEntry *> *zipEntries = [NSMutableArray array];
// Add crash data as the primary file
[zipEntries addObject:[BugSplatZipEntry entryWithFilename:crashFilename ?: @"crash.crashlog" data:crashData]];
// Add all attachments to the ZIP (wrapped to prevent crashes from bad attachments)
for (BugSplatAttachment *attachment in attachments) {
@try {
if (attachment && attachment.attachmentData && attachment.filename) {
[zipEntries addObject:[BugSplatZipEntry entryWithFilename:attachment.filename data:attachment.attachmentData]];
NSLog(@"BugSplat: Adding attachment to ZIP: %@", attachment.filename);
}
} @catch (NSException *exception) {
NSLog(@"BugSplat: Exception adding attachment to ZIP: %@ - %@", exception.name, exception.reason);
// Continue with remaining attachments
}
}
NSData *zipData = [BugSplatZipHelper zipEntries:zipEntries];
if (!zipData) {
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: @"Failed to create ZIP archive"}];
completion(NO, error, nil);
return;
}
NSString *md5Hash = [BugSplatZipHelper md5HashOfData:zipData];
// Step 1: Get presigned URL (using crash-time values)
[self getPresignedURLForDatabase:database
applicationName:appName
applicationVersion:appVersion
size:zipData.length
completion:^(NSString *presignedURL, NSError *error) {
if (error) {
completion(NO, error, nil);
return;
}
// Step 2: Upload to S3
[self uploadData:zipData toPresignedURL:presignedURL completion:^(BOOL success, NSError *uploadError) {
if (!success) {
completion(NO, uploadError, nil);
return;
}
// Step 3: Commit the upload (using crash-time values)
[self commitUploadWithS3Key:presignedURL
md5Hash:md5Hash
database:database
applicationName:appName
applicationVersion:appVersion
metadata:metadata
completion:completion];
}];
}];
} @catch (NSException *exception) {
NSLog(@"BugSplat: Exception in uploadCrashReport: %@ - %@", exception.name, exception.reason);
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Exception: %@", exception.reason]}];
completion(NO, error, nil);
}
}
- (void)uploadFeedback:(NSString *)title
description:(NSString *)description
attachments:(NSArray<BugSplatAttachment *> *)attachments
metadata:(BugSplatCrashMetadata *)metadata
completion:(void (^)(NSError * _Nullable error))completion
{
// Substitute a no-op block so the upload proceeds even without a caller-supplied completion
void (^safeCompletion)(NSError * _Nullable) = completion ?: ^(NSError * _Nullable __unused error) {};
@try {
// Validate that title is non-nil and non-empty
if (!title || title.length == 0) {
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: @"Feedback title is required and cannot be empty"}];
safeCompletion(error);
return;
}
metadata.crashTypeId = @"36";
// Create feedback.json content
NSMutableDictionary *feedbackDict = [NSMutableDictionary dictionary];
feedbackDict[@"title"] = title;
feedbackDict[@"description"] = description ?: @"";
NSError *jsonError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:feedbackDict options:0 error:&jsonError];
if (jsonError) {
safeCompletion(jsonError);
return;
}
// Create zip entries starting with feedback.json
NSMutableArray<BugSplatZipEntry *> *zipEntries = [NSMutableArray array];
[zipEntries addObject:[BugSplatZipEntry entryWithFilename:@"feedback.json" data:jsonData]];
// Add all attachments to the ZIP (same pattern as crash report uploads)
for (BugSplatAttachment *attachment in attachments) {
@try {
if (attachment && attachment.attachmentData && attachment.filename) {
[zipEntries addObject:[BugSplatZipEntry entryWithFilename:attachment.filename data:attachment.attachmentData]];
NSLog(@"BugSplat: Adding attachment to feedback ZIP: %@", attachment.filename);
}
} @catch (NSException *exception) {
NSLog(@"BugSplat: Exception adding attachment to feedback ZIP: %@ - %@", exception.name, exception.reason);
// Continue with remaining attachments
}
}
NSData *zipData = [BugSplatZipHelper zipEntries:zipEntries];
if (!zipData) {
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: @"Failed to create feedback ZIP archive"}];
safeCompletion(error);
return;
}
// Use crash-time values from metadata, fall back to upload service defaults
NSString *database = metadata.database ?: self.database;
NSString *appName = metadata.applicationName ?: self.applicationName;
NSString *appVersion = metadata.applicationVersion ?: self.applicationVersion;
NSString *md5Hash = [BugSplatZipHelper md5HashOfData:zipData];
// Step 1: Get presigned URL
[self getPresignedURLForDatabase:database
applicationName:appName
applicationVersion:appVersion
size:zipData.length
completion:^(NSString *presignedURL, NSError *error) {
if (error) {
safeCompletion(error);
return;
}
// Step 2: Upload to S3
[self uploadData:zipData toPresignedURL:presignedURL completion:^(BOOL success, NSError *uploadError) {
if (!success) {
safeCompletion(uploadError);
return;
}
// Step 3: Commit the upload
[self commitUploadWithS3Key:presignedURL
md5Hash:md5Hash
database:database
applicationName:appName
applicationVersion:appVersion
metadata:metadata
completion:^(BOOL commitSuccess, NSError *commitError, NSString *infoUrl) {
if (commitSuccess) {
NSLog(@"BugSplat: User feedback uploaded successfully");
safeCompletion(nil);
} else {
safeCompletion(commitError);
}
}];
}];
}];
} @catch (NSException *exception) {
NSLog(@"BugSplat: Exception in uploadFeedback: %@ - %@", exception.name, exception.reason);
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Exception: %@", exception.reason]}];
safeCompletion(error);
}
}
- (void)cancelUpload
{
[self.currentTask cancel];
self.currentTask = nil;
}
#pragma mark - Step 1: Get Presigned URL
- (void)getPresignedURLForDatabase:(NSString *)database
applicationName:(NSString *)appName
applicationVersion:(NSString *)appVersion
size:(NSUInteger)size
completion:(void(^)(NSString * _Nullable url, NSError * _Nullable error))completion
{
NSString *urlString = [NSString stringWithFormat:
@"https://%@.bugsplat.com/api/getCrashUploadUrl?database=%@&appName=%@&appVersion=%@&crashPostSize=%lu",
database,
[self urlEncode:database],
[self urlEncode:appName],
[self urlEncode:appVersion],
(unsigned long)size];
NSURL *url = [NSURL URLWithString:urlString];
if (!url) {
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: @"Invalid URL"}];
completion(nil, error);
return;
}
NSURLRequest *request = [NSURLRequest requestWithURL:url];
self.currentTask = [self.urlSession dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
completion(nil, error);
});
return;
}
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
if (httpResponse.statusCode == 429) {
NSError *rateLimitError = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeRateLimited
userInfo:@{NSLocalizedDescriptionKey: @"Too many requests"}];
dispatch_async(dispatch_get_main_queue(), ^{
completion(nil, rateLimitError);
});
return;
}
if (httpResponse.statusCode != 200) {
NSError *serverError = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeServerError
userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Server returned status %ld", (long)httpResponse.statusCode]}];
dispatch_async(dispatch_get_main_queue(), ^{
completion(nil, serverError);
});
return;
}
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
if (jsonError || !json[@"url"]) {
NSError *parseError = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeServerError
userInfo:@{NSLocalizedDescriptionKey: @"Invalid server response"}];
dispatch_async(dispatch_get_main_queue(), ^{
completion(nil, parseError);
});
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
completion(json[@"url"], nil);
});
}];
[self.currentTask resume];
}
#pragma mark - Step 2: Upload to S3
- (void)uploadData:(NSData *)data
toPresignedURL:(NSString *)presignedURLString
completion:(void(^)(BOOL success, NSError * _Nullable error))completion
{
NSURL *presignedURL = [NSURL URLWithString:presignedURLString];
if (!presignedURL) {
NSError *error = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeInvalidData
userInfo:@{NSLocalizedDescriptionKey: @"Invalid presigned URL"}];
completion(NO, error);
return;
}
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:presignedURL];
request.HTTPMethod = @"PUT";
[request setValue:@"application/octet-stream" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)data.length] forHTTPHeaderField:@"Content-Length"];
self.currentTask = [self.urlSession uploadTaskWithRequest:request fromData:data completionHandler:^(NSData *responseData, NSURLResponse *response, NSError *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
completion(NO, error);
});
return;
}
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
if (httpResponse.statusCode != 200) {
NSError *uploadError = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeServerError
userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"S3 upload failed with status %ld", (long)httpResponse.statusCode]}];
dispatch_async(dispatch_get_main_queue(), ^{
completion(NO, uploadError);
});
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
completion(YES, nil);
});
}];
[self.currentTask resume];
}
#pragma mark - Step 3: Commit Upload
- (void)commitUploadWithS3Key:(NSString *)s3Key
md5Hash:(NSString *)md5Hash
database:(NSString *)database
applicationName:(NSString *)appName
applicationVersion:(NSString *)appVersion
metadata:(BugSplatCrashMetadata *)metadata
completion:(BugSplatUploadCompletion)completion
{
NSString *urlString = [NSString stringWithFormat:@"https://%@.bugsplat.com/api/commitS3CrashUpload", database];
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
// Create multipart form data
NSString *boundary = [[NSUUID UUID] UUIDString];
[request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary] forHTTPHeaderField:@"Content-Type"];
NSMutableData *body = [NSMutableData data];
// Required fields - use crash-time values passed as parameters
[self appendFormField:@"database" value:database boundary:boundary toData:body];
[self appendFormField:@"appName" value:appName boundary:boundary toData:body];
[self appendFormField:@"appVersion" value:appVersion boundary:boundary toData:body];
if (metadata.crashTypeId) {
[self appendFormField:@"crashTypeId" value:metadata.crashTypeId boundary:boundary toData:body];
if ([metadata.crashTypeId isEqualToString:@"36"]) {
[self appendFormField:@"crashType" value:@"User.Feedback" boundary:boundary toData:body];
} else {
#if TARGET_OS_OSX
[self appendFormField:@"crashType" value:@"macOS" boundary:boundary toData:body];
#else
[self appendFormField:@"crashType" value:@"iOS" boundary:boundary toData:body];
#endif
}
} else {
#if TARGET_OS_OSX
[self appendFormField:@"crashType" value:@"macOS" boundary:boundary toData:body];
[self appendFormField:@"crashTypeId" value:@"13" boundary:boundary toData:body];
#else
[self appendFormField:@"crashType" value:@"iOS" boundary:boundary toData:body];
[self appendFormField:@"crashTypeId" value:@"26" boundary:boundary toData:body];
#endif
}
[self appendFormField:@"s3key" value:s3Key boundary:boundary toData:body];
[self appendFormField:@"md5" value:md5Hash boundary:boundary toData:body];
// Optional metadata fields
if (metadata.userName.length > 0) {
[self appendFormField:@"user" value:metadata.userName boundary:boundary toData:body];
}
if (metadata.userEmail.length > 0) {
[self appendFormField:@"email" value:metadata.userEmail boundary:boundary toData:body];
}
if (metadata.userDescription.length > 0) {
[self appendFormField:@"description" value:metadata.userDescription boundary:boundary toData:body];
}
if (metadata.applicationLog.length > 0) {
[self appendFormField:@"appLog" value:metadata.applicationLog boundary:boundary toData:body];
}
if (metadata.applicationKey.length > 0) {
[self appendFormField:@"appKey" value:metadata.applicationKey boundary:boundary toData:body];
}
if (metadata.crashTime.length > 0) {
[self appendFormField:@"crashTime" value:metadata.crashTime boundary:boundary toData:body];
}
if (metadata.notes.length > 0) {
[self appendFormField:@"notes" value:metadata.notes boundary:boundary toData:body];
}
// Attributes as JSON string
if (metadata.attributes.count > 0) {
NSError *jsonError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:metadata.attributes options:0 error:&jsonError];
if (jsonData && !jsonError) {
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
[self appendFormField:@"attributes" value:jsonString boundary:boundary toData:body];
}
}
// Note: Attachments are included in the ZIP file uploaded to S3, not sent here
// End boundary
[body appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
request.HTTPBody = body;
self.currentTask = [self.urlSession dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
completion(NO, error, nil);
});
return;
}
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
if (httpResponse.statusCode != 200) {
NSString *responseBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSError *commitError = [NSError errorWithDomain:BugSplatUploadErrorDomain
code:BugSplatUploadErrorCodeServerError
userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Commit failed with status %ld: %@", (long)httpResponse.statusCode, responseBody ?: @""]}];
dispatch_async(dispatch_get_main_queue(), ^{
completion(NO, commitError, nil);
});
return;
}
// Parse response to extract infoUrl
NSString *infoUrl = nil;
if (data.length > 0) {
NSError *jsonError = nil;
NSDictionary *responseJson = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
if (!jsonError && [responseJson isKindOfClass:[NSDictionary class]]) {
infoUrl = responseJson[@"infoUrl"];
if (infoUrl) {
NSLog(@"BugSplat: Crash report info URL: %@", infoUrl);
}
}
}
NSLog(@"BugSplat: Crash report uploaded successfully");
dispatch_async(dispatch_get_main_queue(), ^{
completion(YES, nil, infoUrl);
});
}];
[self.currentTask resume];
}
#pragma mark - Helpers
- (NSString *)urlEncode:(NSString *)string
{
return [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
}
- (void)appendFormField:(NSString *)name
value:(NSString *)value
boundary:(NSString *)boundary
toData:(NSMutableData *)data
{
[data appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[data appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n", name] dataUsingEncoding:NSUTF8StringEncoding]];
[data appendData:[[NSString stringWithFormat:@"%@\r\n", value] dataUsingEncoding:NSUTF8StringEncoding]];
}
- (void)appendFileField:(NSString *)name
filename:(NSString *)filename
contentType:(NSString *)contentType
data:(NSData *)fileData
boundary:(NSString *)boundary
toData:(NSMutableData *)data
{
[data appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[data appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", name, filename] dataUsingEncoding:NSUTF8StringEncoding]];
[data appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", contentType ?: @"application/octet-stream"] dataUsingEncoding:NSUTF8StringEncoding]];
[data appendData:fileData];
[data appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
}
@end