@@ -43,8 +43,7 @@ + (id)sharedManager {
43
43
- (id )init {
44
44
self = [super init ];
45
45
if (self) {
46
- // We can try to update is Sparkle isn't already loaded in our host.
47
- _canUpdate = !objc_getClass (" SUUpdater" );
46
+ _canUpdate = NO ;
48
47
}
49
48
return self;
50
49
}
@@ -62,8 +61,6 @@ - (SUUpdater*)_updater {
62
61
if (_updater)
63
62
return _updater;
64
63
65
- NSAssert (_canUpdate, nil );
66
-
67
64
NSString *frameworksPath = [[NSBundle bundleForClass: [self class ]] privateFrameworksPath ];
68
65
NSAssert (frameworksPath, nil );
69
66
@@ -82,10 +79,13 @@ - (SUUpdater*)_updater {
82
79
Class updaterClass = objc_getClass (" SUUpdater" );
83
80
NSAssert (updaterClass, nil );
84
81
85
- _updater = [updaterClass updaterForBundle: clickToFlashBundle];
86
- NSAssert (_updater, nil );
87
-
88
- [_updater setDelegate: self ];
82
+ if ([updaterClass respondsToSelector: @selector (updaterForBundle: )]) {
83
+ _canUpdate = YES ;
84
+ _updater = [updaterClass updaterForBundle: clickToFlashBundle];
85
+ NSAssert (_updater, nil );
86
+
87
+ [_updater setDelegate: self ];
88
+ }
89
89
}
90
90
91
91
if (error) NSLog (@" error loading ClickToFlash's Sparkle: %@ " , error);
@@ -103,8 +103,8 @@ - (void)startAutomaticallyCheckingForUpdates {
103
103
if (!checkedForUpdate) {
104
104
checkedForUpdate = YES ;
105
105
106
+ SUUpdater *updater = [self _updater ];
106
107
if (_canUpdate) {
107
- SUUpdater *updater = [self _updater ];
108
108
[updater checkForUpdatesInBackground ];
109
109
[updater setAutomaticallyChecksForUpdates: YES ];
110
110
}
0 commit comments