質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
iOS

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Q&A

0回答

1233閲覧

Podファイルで'AFHTTPRequestOperationManager.h' file not foundのエラー

Shichi7

総合スコア35

iOS

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

0グッド

0クリップ

投稿2019/05/13 08:59

環境は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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問