mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 21:16:35 +00:00
Fix finding the resource bundle
This commit is contained in:
parent
a334952b37
commit
23e2183c87
@ -91,42 +91,55 @@ typedef enum BITCrashAlertType {
|
||||
|
||||
_serverResult = BITCrashStatusUnknown;
|
||||
_crashIdenticalCurrentVersion = YES;
|
||||
_crashData = nil;
|
||||
_urlConnection = nil;
|
||||
_responseData = nil;
|
||||
_sendingInProgress = NO;
|
||||
|
||||
_didCrashInLastSession = NO;
|
||||
_timeintervalCrashInLastSessionOccured = -1;
|
||||
_fileManager = [[NSFileManager alloc] init];
|
||||
|
||||
NSString *testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kBITCrashAnalyzerStarted];
|
||||
if (testValue) {
|
||||
_analyzerStarted = [[NSUserDefaults standardUserDefaults] integerForKey:kBITCrashAnalyzerStarted];
|
||||
} else {
|
||||
_analyzerStarted = 0;
|
||||
}
|
||||
_approvedCrashReports = [[NSMutableDictionary alloc] init];
|
||||
_analyzerStarted = NO;
|
||||
|
||||
_fileManager = [[NSFileManager alloc] init];
|
||||
_crashFiles = [[NSMutableArray alloc] init];
|
||||
|
||||
_crashManagerStatus = BITCrashManagerStatusAlwaysAsk;
|
||||
|
||||
testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kBITCrashManagerStatus];
|
||||
NSString *testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kBITCrashManagerStatus];
|
||||
if (testValue) {
|
||||
_crashManagerStatus = [[NSUserDefaults standardUserDefaults] integerForKey:kBITCrashManagerStatus];
|
||||
} else {
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:_crashManagerStatus forKey:kBITCrashManagerStatus];
|
||||
}
|
||||
|
||||
// temporary directory for crashes grabbed from PLCrashReporter
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
_crashesDir = [[NSString stringWithFormat:@"%@", [[paths objectAtIndex:0] stringByAppendingPathComponent:@"/crashes/"]] retain];
|
||||
|
||||
if (![self.fileManager fileExistsAtPath:_crashesDir]) {
|
||||
NSDictionary *attributes = [NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedLong: 0755] forKey: NSFilePosixPermissions];
|
||||
NSError *theError = NULL;
|
||||
|
||||
[self.fileManager createDirectoryAtPath:_crashesDir withIntermediateDirectories: YES attributes: attributes error: &theError];
|
||||
}
|
||||
|
||||
// crash reporting specific settings
|
||||
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
|
||||
NSString *settingsDir = [[[paths objectAtIndex: 0] stringByAppendingPathComponent:BITHOCKEYSDK_IDENTIFIER] stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]];
|
||||
|
||||
if (![_fileManager fileExistsAtPath:settingsDir]) {
|
||||
NSDictionary *attributes = [NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedLong: 0755] forKey: NSFilePosixPermissions];
|
||||
NSError *theError = NULL;
|
||||
|
||||
[_fileManager createDirectoryAtPath:settingsDir withIntermediateDirectories: YES attributes: attributes error: &theError];
|
||||
}
|
||||
|
||||
_settingsFile = [[settingsDir stringByAppendingPathComponent:@"BITCrashManager.plist"] retain];
|
||||
|
||||
// on the very first startup this will always be initialized, since the default value for _crashManagerStatus is BITCrashManagerStatusAlwaysAsk
|
||||
// but we do it anyway, to be able to initialize PLCrashReporter as early as possible
|
||||
if (_crashManagerStatus != BITCrashManagerStatusDisabled) {
|
||||
_crashFiles = [[NSMutableArray alloc] init];
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
_crashesDir = [[NSString stringWithFormat:@"%@", [[paths objectAtIndex:0] stringByAppendingPathComponent:@"/crashes/"]] retain];
|
||||
|
||||
if (![self.fileManager fileExistsAtPath:_crashesDir]) {
|
||||
NSDictionary *attributes = [NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedLong: 0755] forKey: NSFilePosixPermissions];
|
||||
NSError *theError = NULL;
|
||||
|
||||
[self.fileManager createDirectoryAtPath:_crashesDir withIntermediateDirectories: YES attributes: attributes error: &theError];
|
||||
}
|
||||
|
||||
PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter];
|
||||
NSError *error = NULL;
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@
|
||||
}
|
||||
|
||||
if (!BITHockeyBundle()) {
|
||||
NSLog(@"WARNING: %@.bundle is missing, make sure it is added!", BITHOCKEYSDK_BUNDLE);
|
||||
NSLog(@"WARNING: %@ is missing, make sure it is added!", BITHOCKEYSDK_BUNDLE);
|
||||
}
|
||||
|
||||
[self loadAppCache];
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
#define kBITUpdateAuthorizedVersion @"BITUpdateAuthorizedVersion"
|
||||
#define kBITUpdateAuthorizedToken @"BITUpdateAuthorizedToken"
|
||||
|
||||
#define BITHOCKEYSDK_BUNDLE @"HockeySDKResources"
|
||||
#define BITHOCKEYSDK_BUNDLE @"HockeySDKResources.bundle"
|
||||
#define BITHOCKEYSDK_URL @"https://sdk.hockeyapp.net/"
|
||||
|
||||
#define BITHockeyLog(fmt, ...) do { if([BITHockeyManager sharedHockeyManager].isDebugLogEnabled && ![BITHockeyManager sharedHockeyManager].isAppStoreEnvironment) { NSLog((@"[HockeySDK] %s/%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); }} while(0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user