環境はSwift4 Xcode Version 10.2.1です。
新バージョンリリース時に、アプリのアップデートを促すために、こちらのPodファイルを利用しました。
https://github.com/kazu0620/SRGVersionUpdater
'AFHTTPRequestOperationManager.h' file not foundとエラーが出ます。
どうしたらよいでしょうか?
SRGVersionUpdater.m
objectc
1#import "SRGVersionUpdater.h" 2#import "UIAlertView+BlocksKit.h" 3#import "AFHTTPRequestOperationManager.h" 4 5@implementation SRGVersionUpdater { 6 NSDictionary *versionInfo; 7} 8 9#ifndef SRGVersionUpdaterLocalizedStrings 10#define SRGVersionUpdaterLocalizedStrings(key) \ 11NSLocalizedStringFromTableInBundle(key, @"SRGVersionUpdater", [NSBundle bundleWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"SRGVersionUpdater.bundle"]], nil) 12#endif 13 14- (void) executeVersionCheck { 15 NSAssert(_endPointUrl, @"Set EndPointUrl Before Execute Check"); 16 17 AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager]; 18 manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"application/json",nil]; 19 [manager GET:_endPointUrl parameters:nil 20 success:^(AFHTTPRequestOperation *operation, id responseObject) { 21 versionInfo = responseObject; 22 [self showUpdateAnnounceIfNeeded]; 23 } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 24 NSLog(@"Request Operation Error! %@", error); 25 } 26 ]; 27} 28 29- (void) showUpdateAnnounceIfNeeded { 30 if( ![self isVersionUpNeeded] ) { 31 return; 32 } 33 [self showUpdateAnnounce]; 34} 35 36- (BOOL) isVersionUpNeeded { 37 NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; 38 NSString *requiredVersion = versionInfo[@"required_version"]; 39 return ( [requiredVersion compare:currentVersion options:NSNumericSearch] == NSOrderedDescending ); 40} 41 42- (void) showUpdateAnnounce { 43 UIAlertView *alert = [UIAlertView 44 bk_alertViewWithTitle:[self alertTitle] 45 message:[self alertBody] 46 ]; 47 48 [alert bk_addButtonWithTitle:[self updateButtonText] 49 handler:^(void) { 50 NSURL *updateUrl = [NSURL URLWithString:versionInfo[@"update_url"]]; 51 [[UIApplication sharedApplication] openURL:updateUrl]; 52 }]; 53 54 if([versionInfo[@"type"] isEqualToString:@"optional"]){ 55 [alert addButtonWithTitle: [self cancelButtonText]]; 56 } 57 58 [alert show]; 59} 60 61- (NSString *) alertTitle { 62 return _customAlertTitle ? _customAlertTitle : [self localizedStringWithFormat:@"SRGVersionUpdater.alert.title"]; 63} 64 65- (NSString *) alertBody { 66 return _customAlertBody ? _customAlertBody : [self localizedStringWithFormat:@"SRGVersionUpdater.alert.body"]; 67} 68 69- (NSString *) updateButtonText { 70 return [self localizedStringWithFormat:@"SRGVersionUpdater.alert.updateButton"]; 71} 72 73- (NSString *) cancelButtonText { 74 return [self localizedStringWithFormat:@"SRGVersionUpdater.alert.calcelButton"]; 75} 76 77- (NSInteger) versionNumberFromString:(NSString *)versionString{ 78 return [[versionString stringByReplacingOccurrencesOfString:@"." withString:@""] intValue]; 79} 80 81- (NSString *) localizedStringWithFormat:(NSString *)format { 82 return SRGVersionUpdaterLocalizedStrings(format); 83} 84 85@end 86
あなたの回答
tips
プレビュー