This repository has been archived by the owner on May 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRRXcodeRemoteDeviceFixer.m
61 lines (48 loc) · 1.75 KB
/
RRXcodeRemoteDeviceFixer.m
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
//
// RRXcodeRemoteDeviceFixer.m
// xcodeRemoteDeviceFixer
//
// Created by Evan Schoenberg on 8/2/11.
// Copyright 2011 Regular Rate and Rhythm Software. All rights reserved.
//
#import "RRXcodeRemoteDeviceFixer.h"
#import "JRSwizzle.h"
@interface DTDKRemoteDeviceToken : NSObject
@end
@implementation DTDKRemoteDeviceToken (_RRXcodeRemoteDeviceFixer_DTDKRemoteDeviceToken)
- (BOOL)_RRXcodeRemoteDeviceFixer_getNeedsToFetchSharedCache:(id)cache error:(NSError **)outError
{
NSLog(@"Preventing an attempt to connect to a remote iOS device via getNeedsToFetchSharedCache:error:.");
if (outError != NULL)
*outError = nil;
return NO;
}
@end
@implementation RRXcodeRemoteDeviceFixer
/**
* A special method called by SIMBL once the application has started and all classes are initialized.
*/
+ (void) load
{
if (self == [RRXcodeRemoteDeviceFixer class]) {
static RRXcodeRemoteDeviceFixer *plugin = nil;
if (plugin == nil)
plugin = [[RRXcodeRemoteDeviceFixer alloc] init];
NSLog(@"XcodeRemoteDeviceFixer installed");
}
}
- (id)init
{
self = [super init];
if (self) {
NSError *error = nil;
NSLog(@"Swizzling to prevent %@ from calling getNeedsToFetchSharedCache:error:", NSStringFromClass(NSClassFromString(@"DTDKRemoteDeviceToken")));
if (![NSClassFromString(@"DTDKRemoteDeviceToken") jr_swizzleMethod:@selector(getNeedsToFetchSharedCache:error:)
withMethod:@selector(_RRXcodeRemoteDeviceFixer_getNeedsToFetchSharedCache:error:)
error:&error]) {
NSLog(@"Couldn't swizzle; error was %@", error);
}
}
return self;
}
@end