Vapor本地搭建记录

Vapor本地搭建记录

1、homebrew版本过老导致以下问题

➜  ZXServer git:(main) brew install vapor/tap/vapor
Traceback (most recent call last):
	11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
	10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
	 9: from /usr/local/Homebrew/Library/Homebrew/global.rb:37:in `<top (required)>'
	 8: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	 7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	 6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
	 5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
	 4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
	 3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
	 2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
	 1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)

解决办法,更新homebrew:

brew update-reset

动态替换iOS app图标

动态替换iOS app图标

步骤:

1、准备两张想要替换的图,不要放到asset中,记着放到文件夹中,如下图:

2、在info.plist文件中添加相关配置:

<key>CFBundleIcons</key>
	<dict>
		<key>CFBundleAlternateIcons</key>
		<dict>
			<key>AppIcon-2</key>
			<dict>
				<key>CFBundleIconFiles</key>
				<array>
					<string>AppIcon-2</string>
				</array>
			</dict>
		</dict>
	</dict>

3、设置代码:

判断节日时间(非必需):

- (BOOL)checkTodayIsFestival {
    NSDate *date = [NSDate new];
    NSString *beginDateString = @"20210208 00:00:00";
    NSString *endDateString = @"20210220 23:59:59";
    NSDateFormatter *format = [[NSDateFormatter alloc] init];
    [format setDateFormat:@"yyyyMMdd HH:mm:ss"];
    NSDate *beginDate = [format dateFromString:beginDateString];
    NSDate *endDate = [format dateFromString:endDateString];
    if ([date isLaterThanDate:beginDate] && [date isEarlierThanDate:endDate]) {
        [NSNotificationCenter.defaultCenter postNotificationName:kChangeSkinNotification object:nil];
        return YES;
    } else {
        return NO;
    }
}

设置图标:

- (void)checkNeedChangeAppIcon {
    if (@available(iOS 10.3, *)) {
        if ([UIApplication sharedApplication].supportsAlternateIcons) {
            NSString *currentIconName = [UIApplication sharedApplication].alternateIconName;
            if ([AppConfig.shared checkTodayIsFestival]) {
                [[UIApplication sharedApplication] setAlternateIconName:@"AppIcon-2" completionHandler:^(NSError * _Nullable error) {
                    if (error) {
                        MMLog(@"change icon error: %@", error.localizedDescription);
                    }
                }];
            } else {
                if (!currentIconName || (currentIconName && [currentIconName isEqualToString:@"AppIcon-2"])) {
                    [[UIApplication sharedApplication] setAlternateIconName:nil completionHandler:^(NSError * _Nullable error) {
                        if (error) {
                            MMLog(@"change icon error: %@", error.localizedDescription);
                        }
                    }];
                }
            }
        }
    }
}

4、把弹框解决掉(非必需):

通过runtime动态处理:

#import "UIViewController+Present.h"
#import <objc/runtime.h>

@implementation UIViewController (Present)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        Method presentM = class_getInstanceMethod(self.class, @selector(presentViewController:animated:completion:));
        Method presentSwizzlingM = class_getInstanceMethod(self.class, @selector(mm_presentViewController:animated:completion:));
        // 交换方法实现
        method_exchangeImplementations(presentM, presentSwizzlingM);
    });
}

- (void)mm_presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
    if ([viewControllerToPresent isKindOfClass:[UIAlertController class]]) {
        NSLog(@"title : %@",((UIAlertController *)viewControllerToPresent).title);
        NSLog(@"message : %@",((UIAlertController *)viewControllerToPresent).message);
        
        UIAlertController *alertController = (UIAlertController *)viewControllerToPresent;
        //都是空的时候认为是换图标的弹框,不弹了
        if (alertController.title == nil && alertController.message == nil && [AppConfig.shared checkTodayIsFestival]) {
            return;
        } else {
            [self mm_presentViewController:viewControllerToPresent animated:flag completion:completion];
            return;
        }
    }
    
    [self mm_presentViewController:viewControllerToPresent animated:flag completion:completion];
}

@end

关于iOS的推送证书

关于iOS的推送证书

Development Push SSL Certificate ,与Production Push SSL Certificate 区别在于一个是用于开发的推送证书,一个是用于发布产品的推送证书。两个证书获取到的终端deviceToken是不一样的,用两个证书生成的P12证书用于JAVA后台连接APNS的服务器地址也是不同的,Development Push SSL Certificate 对应连接的服务器地址是:gateway.sandbox.push.apple.com。Production Push SSL Certificate 对应连接的服务器地址是:gateway.push.apple.com

丘处机之过

转自网络
1、假如当时丘处机没有路过牛家村。 那么,秘密跟踪他的那些金兵就不会死在郭,杨二人的院子里,同样,完颜洪烈也不会见到包惜弱而对她念念不忘。
2、那些金兵不会死在丘处机手里,而郭,杨两家以后不会受到牵连。
3、郭,杨两家不受波及,李萍不会流亡大漠,郭靖和杨康将会平平安安出生在牛家村。江南七怪自然也不会前往大漠。
4、而要是没有郭靖和七怪相助,铁木真就会死在扎木合他们手里,蒙古各部也就不能统一。
5、蒙古不能统一,也就不会有什么西征。火药就不会传入欧洲。
6、没有火药,铁甲士在欧洲的统治就不会动摇。因此,黑暗的中世纪将延长一千年,也就没有文艺复兴。
7、没有了文艺复兴,自然也没有大航海。北美洲将始终是游牧的印第安人的家园。
8、同样,西班牙人不会将铁炮传入日本。长筱会战是武田方面获胜,日本战国时代将一直持续不能统一。
9、在另一国度,完颜洪烈没有包惜弱,只能全力参加党争。金国因此会内乱。
10、没有蒙古,金国又内乱,因此,宋不但不会灭亡,反而会统一。宋朝注重商贸,因此,资本主义萌芽将在中国出现。
11、如果发展到今天,中国将是最发达的国家,远远领先于日本,西班牙,西欧,美洲。
12、今天的金融危机也就不会出现,所有的一切,都怪丘处机,你说你一道士,没事干嘛路过什么牛家村嘛

都怪丘处机!!!