2019-11-07 -0001:
1:WCDB .mm 是在还不行的话 target-buildSetting 中做如下修改
2:值:-objC,-all_load,-force_load
-all_load : 在iOS 中,使用-all_load时,如果静态库中有类别时会出问题,使用其他两个值则不会有问题。
#不要用 -all_load
3:手机磁盘剩余空间
导入头文件
#include 《<sys/param.h> <sys/mount.h>》
#pragma mark 空间剩余
-(void)spaceFreeAndTotal{
struct statfs buf;
long long freespace = -1;
if(statfs("/var", &buf) >=0){
freespace = (longlong)(buf.f_bsize* buf.f_bfree);
}
NSDictionary *fattributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil];
NSNumber*maxber = [fattributes objectForKey:NSFileSystemSize];
// long long freespace = [freeber longLongValue];
freespacestr = [NSString stringWithFormat:@"%0.1fG",freespace/1024.0/1024.0/1024.0];
longlong maxspace = [maxber longLongValue];
totalpacestr= [NSString stringWithFormat:@"%0.1fG",(double)maxspace/1024/1024/1024];
NSString* sizeStr = [NSString stringWithFormat:@"手机存储:总空间 %0.1fG/剩余%0.1fG可用",(double)maxspace/1024/1024/1024,freespace/1024.0/1024.0/1024.0];
showLabelStr = sizeStr;
NSMutableAttributedString *strnn = [[NSMutableAttributedString alloc] initWithString:sizeStr];
[strnnaddAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(9,totalpacestr.length)];
NSInteger whereInt = 9+totalpacestr.length+3;
[strnn addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(whereInt,freespacestr.length)];
self.showFreeSpaceL.attributedText = strnn;
}