私は次のようなものがあります
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"https://www.test.com/"]];
KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"xyz" accessGroup:nil];
すべてのファイルで常に定義する必要があります。それらを1つのファイルで定義し、毎回インポートする方法はありますか?
編集
提案されたように、これをアプリのデリゲートに追加しました
#import <UIKit/UIKit.h>
@class AFHTTPClient;
@class KeychainItemWrapper;
@interface TestAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, strong, readonly) AFHTTPClient *httpClient;
@property (nonatomic, strong, readonly) KeychainItemWrapper *keychainItem;
@end
次に、ビューコントローラでhttpClientを次のように定義しようとしました。
httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"https://www.test.com/"]];
それは私に言うエラーを与えますuse of undeclared identifier 'httpClient'