浪费。 2019-05-14 01:00 采纳率: 50%
浏览 861
已结题

library not found for - IFMDB的问题。

这个我实在找不到到底哪里出了问题,也按照网上的教程删除了 Library Search Paths 中的路径,确实找不到问题所在。
图片说明

我贴上代码麻烦大神帮忙看一下,谢谢。

DataBase.h

#import <Foundation/Foundation.h>
@class MainUser;


@interface DataBase : NSObject
@property(nonatomic,strong)MainUser *mainUser;

+(instancetype)sharedDataBase;

-(void)addMainUser:(MainUser *)mainUser;

-(void)updateMainUserName:(MainUser *)mainUser;

-(void)updateMainUserHeadImage:(MainUser *)mainUser;

-(void)updateMainUserID:(MainUser *)mainUser;

-(NSMutableArray *)getAllUser;




@end
DataBase.m


#import "DataBase.h"
#import "MainUser.h"
#import "FMDB.h"

static DataBase *_dbControl = nil;

@interface DataBase()<NSCopying,NSMutableCopying>{
    FMDatabase *_db;
}

@end

@implementation DataBase
+(instancetype)sharedDataBase{
    if (_dbControl == nil) {
        _dbControl = [[DataBase alloc]init];
        [_dbControl initDataBase];
    }
    return _dbControl;
}

+(instancetype)allocWithZone:(struct _NSZone *)zone{
    if(_dbControl == nil){
        _dbControl = [super allocWithZone:zone];
    }
    return _dbControl;
}

-(void)initDataBase{
    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];

    NSString *filePath = [documentPath stringByAppendingPathComponent:@"slz.sqlite"];

    _db = [FMDatabase databaseWithPath:filePath];

    [_db open];

    NSString *mainUserSql = @"CREAT TABLE 'MainUser' ('mainUser_type' VARCHAR(255),'mainUser_name' VARCHAR(255),'mainUser_headImage' BLOB,'mainUser_phoneType' VARCHAR(255),'mainUser_ID'VARCHAR(255))";
    [_db executeUpdate:mainUserSql];
    [_db close];
}

-(id)copy{

    return self;

}

-(id)mutableCopy{

    return self;

}

-(id)copyWithZone:(NSZone *)zone{

    return self;

}

-(id)mutableCopyWithZone:(NSZone *)zone{

    return self;

}

#pragma mark-------------------------初始化用户(先存储到数据库里)----------------------------

-(void)addMainUser:(MainUser *)mainUser{
    [_db open];
    NSNumber *UserType= @(1);
    [_db executeUpdate:@"INSERT INTO mainUser(mainUser_type,mainUser_name,mainUser_headImage,mainUser_phoneType,mainUser_ID)VALUES(?,?,?,?,?)",UserType,mainUser.name,mainUser.headImage,mainUser.phoneType,mainUser.ID];
    [_db close];
}

#pragma mark--------------------------------更新三连QAQ----------------------------------------

-(void)updateMainUserName:(MainUser *)mainUser{
    [_db open];

    [_db executeUpdate:@"UPDATE 'mainUser' SET mainUser_name = ? WHERE mainUser_type = ?",mainUser.name,mainUser.type];

    [_db close];
}

-(void)updateMainUserHeadImage:(MainUser *)mainUser{
    [_db open];

    [_db executeUpdate:@"UPDATE 'mainUser' SET mainUser_headImage = ? WHERE mainUser_type = ?",mainUser.headImage,mainUser.type];

    [_db close];
}

-(void)updateMainUserID:(MainUser *)mainUser{
    [_db open];

    [_db executeUpdate:@"UPDATE 'mainUser' SET mainUser_ID = ? WHERE mainUser_type = ?",mainUser.ID,mainUser.type];

    [_db close];
}



-(NSMutableArray *)getAllUser{
    [_db open];
    NSMutableArray *dataArray = [[NSMutableArray alloc]init];
    FMResultSet *res = [_db executeQuery:@"SELECT * mainUser"];
    MainUser *selfUser = [[MainUser alloc]init];
    selfUser.type = @([[res stringForColumn:@"mainUser_type"]integerValue]);
    selfUser.name = [res stringForColumn:@"mainUser_name"];
    selfUser.headImage = [res stringForColumn:@"mainUser_headImage"];
    selfUser.ID = [res stringForColumn:@"mainUser_ID"];

    [dataArray addObject:selfUser];
    [_db close];

    return dataArray;

}



@end
MineViewController.h

#import <UIKit/UIKit.h>


@interface MineViewController : UIViewController
@property(nonatomic,strong)UIImageView *headView;
@property(nonatomic,strong)UILabel     *userName;
@property(nonatomic,strong)UILabel     *userID;

@end
MineViewController.m

#import "MineViewController.h"
#import "DataBase.h"
#import "MainUser.h"

@interface MineViewController ()
@property(nonatomic,strong) NSMutableArray *dataArray;
@end

@implementation MineViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = sbackgroundColor;

    [self creatUI];

}

-(void)creatUI{
    UIView *backgroundView = [[UIView alloc]initWithFrame:CGRectMake(0, 30, screenWidth, 180)];
    backgroundView.backgroundColor = [UIColor whiteColor];
    backgroundView.layer.shadowColor = [UIColor grayColor].CGColor;
    backgroundView.layer.shadowOffset = CGSizeMake(0, 10);
    backgroundView.layer.shadowOpacity = 0.2;
    backgroundView.layer.shadowRadius = 15;
    UIView *TwobackgroundView = [[UIView alloc]initWithFrame:CGRectMake(0, 300, screenWidth, 280)];
    TwobackgroundView.backgroundColor = [UIColor whiteColor];
    _headView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 20, 120,120)];
    _headView.layer.masksToBounds = YES;
    _headView.layer.cornerRadius = 50;
    //https://www.jianshu.com/p/a8b731d0a84d此页面设置不是所有角都为圆角
    _headView.image = [UIImage imageNamed:@"22"];
    _userName = [[UILabel alloc]initWithFrame:CGRectMake(_headView.right+10, _headView.top, 100, 40)];

    _userName.font = [UIFont systemFontOfSize:13];
    _userID = [[UILabel alloc]initWithFrame: CGRectMake(_userName.left, _userName.bottom+10, 100, 20)];

    _userID.font = [UIFont systemFontOfSize:13];
}

-(void)addData{
    NSLog(@"addData");
    //UIImage *image = [UIImage imageNamed:@"1"];
    //NSData *imageData = UIImagePNGRepresentation(image);
    NSString *name = @"沙雕网友";
    NSString *ID = @"sle759";

    MainUser *mainUser = [[MainUser alloc]init];
    mainUser.name = name;
    mainUser.ID = ID;

    [[DataBase sharedDataBase]addMainUser:mainUser];
    self.dataArray = [[DataBase sharedDataBase]getAllUser];
}

- (NSMutableArray *)dataArray{
    if (!_dataArray) {
        _dataArray = [[NSMutableArray alloc] init];

    }
    return _dataArray;

}

@end

AppDelegate.m

#import "AppDelegate.h"
#import "MineViewController.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSLog(@"application");

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    MineViewController *FMVc = [[MineViewController alloc] init];

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:FMVc];

    self.window.rootViewController = navController;


    [self.window makeKeyAndVisible];

    return YES;
}


EchoMacros.h
#pragma mark ------------------ 全局 ------------------

// 弱引用
#define WS(wSelf)               __weak typeof(self) wSelf = self
// RGB颜色
#define MMRGBColor(r,g,b)       [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]


// 屏幕物理尺寸宽度
#define screenWidth         [UIScreen mainScreen].bounds.size.width
// 屏幕物理尺寸高度
#define screenHeight         [UIScreen mainScreen].bounds.size.height
// 状态栏高度
#define statusHeight         [[UIApplication sharedApplication] statusBarFrame].size.height
// 导航栏高度
#define navHeight            self.navigationController.navigationBar.height
// 顶部整体高度
#define topHeight            (statusHeight + navHeight)
// 背景颜色
#define sbackgroundColor      [UIColor colorWithRed:0.94 green:0.94 blue:0.96 alpha:1.0]

#pragma mark  ----------------iPhone X---------------------
#define iphone_x              (screenWidth >= 812.0f)
// tabbar高度
#define k_bar_height            (iphone_x ? 83.0 : 49.0)





#pragma mark ------------------ 世界 ------------------

// 头像视图的宽、高
#define sAvatarWidth            50
// 名字视图高度
#define sNameLabelH             20
// 时间视图高度
#define sTimeLabelH             15

// 操作按钮的宽度
#define sOperateBtnWidth        30
// 操作视图的高度
#define sOperateHeight          38
// 操作视图的宽度
#define sOperateWidth           200

// 顶部和底部的留白
#define sBlank                  15
// 右侧留白
#define sRightMargin            15

// 内容视图宽度
#define sTextWidth              (screenWidth - 60 - 25)
// 正文字体
#define sComTextWidth           (screenWidth - 30)
#define sTextFont               [UIFont systemFontOfSize:15.0]
// 评论字体
#define sComTextFont            [UIFont systemFontOfSize:15.0]
// 评论高亮字体
#define sComHLTextFont          [UIFont boldSystemFontOfSize:15.0]
// 主色调高亮颜色(暗蓝色)
#define sHLTextColor            [UIColor colorWithRed:0.28 green:0.35 blue:0.54 alpha:1.0]
// 正文高亮颜色(蓝色)
#define sLinkTextColor          [UIColor colorWithRed:0.09 green:0.56 blue:0.99 alpha:1.0]
// 按住背景颜色
#define sHLBgColor              [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1.0]

// 图片间距
#define sImagePadding           5
// 图片宽度
#define sImageWidth             ([UIScreen mainScreen].bounds.size.width-40)/3
// 全文/收起按钮高度
#define sMoreLabHeight          20
// 视图之间的间距
#define sPaddingValue           8
// 评论赞视图气泡的尖尖高度
#define sArrowHeight            5
EchoSupport.pch


#import "EchoMacros.h"
#import "UIView+Geometry.h"
#import "UIScrollView+Category.h"

UIView+Geometry.h

#import <UIKit/UIKit.h>

@interface UIView (Geometry)

@property (nonatomic, assign) CGPoint origin;
@property (nonatomic, assign) CGSize size;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGFloat top;
@property (nonatomic, assign) CGFloat bottom;
@property (nonatomic, assign) CGFloat left;
@property (nonatomic, assign) CGFloat right;

@property (nonatomic, assign) CGFloat centerX;
@property (nonatomic, assign) CGFloat centerY;

@end

UIView+Geometry.m


#import "UIView+Geometry.h"

@implementation UIView (Geometry)

- (CGPoint)origin
{
    return self.frame.origin;
}

- (void)setOrigin:(CGPoint)point
{
    CGRect rect = self.frame;
    rect.origin = point;
    self.frame = rect;
}

- (CGSize)size
{
    return self.frame.size;
}

- (void)setSize:(CGSize)size
{
    CGRect rect = self.frame;
    rect.size = size;
    self.frame = rect;
}

- (CGFloat)height
{
    return self.frame.size.height;
}

- (void)setHeight:(CGFloat)height
{
    CGRect rect = self.frame;
    rect.size.height = height;
    self.frame = rect;
}

- (CGFloat)width
{
    return self.frame.size.width;
}

- (void)setWidth:(CGFloat)width
{
    CGRect rect = self.frame;
    rect.size.width = width;
    self.frame = rect;
}

- (CGFloat)top
{
    return self.frame.origin.y;
}

- (void)setTop:(CGFloat)top
{
    CGRect rect = self.frame;
    rect.origin.y = top;
    self.frame = rect;
}

- (CGFloat)left
{
    return self.frame.origin.x;
}

- (void)setLeft:(CGFloat)left
{
    CGRect rect = self.frame;
    rect.origin.x = left;
    self.frame = rect;
}

- (CGFloat)bottom
{
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setBottom:(CGFloat)bottom
{
    CGRect rect = self.frame;
    rect.origin.y = bottom - self.frame.size.height;
    self.frame = rect;
}

- (CGFloat)right
{
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setRight:(CGFloat)right
{
    CGRect rect = self.frame;
    rect.origin.x = right - rect.size.width;
    self.frame = rect;
}

- (CGFloat)centerX
{
    return self.center.x;
}

- (void)setCenterX:(CGFloat)centerX
{
    self.center = CGPointMake(centerX, self.center.y);
}

- (CGFloat)centerY
{
    return self.center.y;
}

- (void)setCenterY:(CGFloat)centerY
{
    self.center = CGPointMake(self.center.x, centerY);
}

@end

  • 写回答

2条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog