Even more conservative approach that doesn't use UIDevice#uniqueIdentifier at all. Instead, you need to implement the delegate method. Forced delegate to implement CNSHockeyManagerDelegate protocol.

This commit is contained in:
Thomas Dohmke
2012-03-25 18:44:14 +02:00
parent 7cc52cf4b9
commit 91cc767d38
4 changed files with 12 additions and 24 deletions

View File

@@ -239,17 +239,13 @@ typedef enum {
///////////////////////////////////////////////////////////////////////////////////////////////////
@protocol BWHockeyManagerDelegate <NSObject>
#if HOCKEY_BLOCK_UDID == 0 || defined (CONFIGURATION_Debug) || defined (CONFIGURATION_AdHoc) || defined (CONFIGURATION_Beta)
@optional
#endif
/*
Return the device UDID which is required for beta testing, should return nil for app store configuration!
The default implementation would be like:
Example implementation if your configuration for the App Store is called "AppStore":
#ifndef (CONFIGURATION_AppStore)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
return nil;

View File

@@ -237,11 +237,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
}
- (NSString *)deviceIdentifier {
#if HOCKEY_BLOCK_UDID == 0 || defined (CONFIGRATION_Debug1) || defined (CONFIGRATION_AdHoc) || defined (CONFIGURATION_Beta)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
if ([delegate_ respondsToSelector:@selector(customDeviceIdentifier)]) {
NSString *identifier = [delegate_ performSelector:@selector(customDeviceIdentifier)];
if (identifier && [identifier length] > 0) {

View File

@@ -25,16 +25,13 @@
@protocol CNSHockeyManagerDelegate <NSObject>
#if HOCKEY_BLOCK_UDID == 0 || defined (CONFIGURATION_Debug) || defined (CONFIGURATION_AdHoc) || defined (CONFIGURATION_Beta)
@optional
#endif
/*
Return the device UDID which is required for beta testing, should return nil for app store configuration!
The default implementation would be like:
Example implementation if your configuration for the App Store is called "AppStore":
#ifndef (CONFIGURATION_AppStore)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
return nil;
@@ -103,7 +100,7 @@
@interface CNSHockeyManager : NSObject {
@private
id delegate;
id<CNSHockeyManagerDelegate> delegate;
NSString *appIdentifier;
}
@@ -224,11 +221,11 @@
// Configure HockeyApp with a single app identifier and delegate; use this
// only for debug or beta versions of your app!
- (void)configureWithIdentifier:(NSString *)appIdentifier delegate:(id)delegate;
- (void)configureWithIdentifier:(NSString *)appIdentifier delegate:(id<CNSHockeyManagerDelegate>)delegate;
// Configure HockeyApp with different app identifiers for beta and live versions
// of the app; the update alert will only be shown for the beta identifier
- (void)configureWithBetaIdentifier:(NSString *)betaIdentifier liveIdentifier:(NSString *)liveIdentifier delegate:(id)delegate;
- (void)configureWithBetaIdentifier:(NSString *)betaIdentifier liveIdentifier:(NSString *)liveIdentifier delegate:(id<CNSHockeyManagerDelegate>)delegate;
// Returns true if the app crashes in the last session
- (BOOL)didCrashInLastSession;

View File

@@ -361,13 +361,13 @@
- (void)configureQuincyManager {
[[BWQuincyManager sharedQuincyManager] setAppIdentifier:appIdentifier];
[[BWQuincyManager sharedQuincyManager] setDelegate:delegate];
[[BWQuincyManager sharedQuincyManager] setDelegate:(id)delegate];
}
- (void)configureHockeyManager {
[[BWHockeyManager sharedHockeyManager] setAppIdentifier:appIdentifier];
[[BWHockeyManager sharedHockeyManager] setCheckForTracker:YES];
[[BWHockeyManager sharedHockeyManager] setDelegate:delegate];
[[BWHockeyManager sharedHockeyManager] setDelegate:(id)delegate];
// Only if JMC is part of the project
if ([[self class] isJMCPresent]) {