测试网络,修改UI

This commit is contained in:
2025-10-30 13:10:33 +08:00
parent 8ce1d95c8c
commit 9b43274e93
6 changed files with 21 additions and 10 deletions

View File

@@ -26,6 +26,8 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
_enabled = NO; // _enabled = NO; //
_timeout = 10.0; _timeout = 10.0;
_defaultHeaders = @{ @"Accept": @"application/json" }; _defaultHeaders = @{ @"Accept": @"application/json" };
//
_baseURL = [NSURL URLWithString:KB_BASE_URL];
} }
return self; return self;
} }

View File

@@ -17,5 +17,8 @@
#import "Masonry.h" #import "Masonry.h"
// 网络基地址Mock环境
#define KB_BASE_URL @"https://m1.apifoxmock.com/m1/5438099-5113192-default/"
#endif /* PrefixHeader_pch */ #endif /* PrefixHeader_pch */

View File

@@ -20,6 +20,8 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoard.CustomKeyb
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self setupRootVC]; [self setupRootVC];
// 访
[KBNetworkManager shared].enabled = YES;
/// ///
[self getNetJudge]; [self getNetJudge];
/// Bugly /// Bugly

View File

@@ -9,6 +9,7 @@
#import "KBGuideVC.h" #import "KBGuideVC.h"
@interface HomeVC () @interface HomeVC ()
@property (nonatomic, strong) UITextView *textView;
@end @end
@@ -17,17 +18,15 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
// Simple demo content so the tab is distinguishable CGRect frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - 200)/2, 150, 200, 200);
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; self.textView = [[UITextView alloc] initWithFrame:frame];
label.text = @"Home"; self.textView.text = @"测试";
label.textColor = [UIColor darkTextColor]; self.textView.layer.borderColor = [UIColor blackColor].CGColor;
label.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold]; self.textView.layer.borderWidth = 0.5;
[label sizeToFit]; [self.view addSubview:self.textView];
label.center = self.view.center; [self.textView becomeFirstResponder];
label.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[self.view addSubview:label];
[[KBNetworkManager shared] GET:@"https://m1.apifoxmock.com/m1/5438099-5113192-default/app/config" parameters:nil headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) { [[KBNetworkManager shared] GET:@"app/config" parameters:nil headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"===="); NSLog(@"====");
}]; }];
} }

View File

@@ -26,6 +26,8 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
_enabled = NO; // _enabled = NO; //
_timeout = 10.0; _timeout = 10.0;
_defaultHeaders = @{ @"Accept": @"application/json" }; _defaultHeaders = @{ @"Accept": @"application/json" };
//
_baseURL = [NSURL URLWithString:KB_BASE_URL];
} }
return self; return self;
} }

View File

@@ -29,6 +29,9 @@
//-----------------------------------------------宏定义全局----------------------------------------------------------/ //-----------------------------------------------宏定义全局----------------------------------------------------------/
// 网络基地址Mock环境
#define KB_BASE_URL @"https://m1.apifoxmock.com/m1/5438099-5113192-default/"
/// UI 尺寸/设备宏 /// UI 尺寸/设备宏
// 屏幕尺寸 // 屏幕尺寸
#define KB_SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) #define KB_SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)