【问题标题】:Build error: Undefined symbols for architecture i386?构建错误:体系结构 i386 的未定义符号?
【发布时间】:2012-04-13 15:01:15
【问题描述】:

我在使用带有 Storyboard 的 XCode4 的 iPad 应用程序上遇到此构建错误:

架构 i386 的未定义符号:“_OBJC_CLASS_$_SQLite”, 引用自:EnterDataViewController.o中的objc-class-ref

我在应用程序中查看了我所知道的所有地方,进行了清理并重新构建了所有内容,但均无济于事。我看不出错误在说什么。

发生了什么,我该如何解决?

更新:这里是来自 EnterDataVewController.m 的相关代码

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//--  set First Responder
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- (BOOL) textFieldShouldReturn:(UITextField *)textField  {

    //  for site data...
    if(textField == txtSiteID)  {
        [txtSTA becomeFirstResponder];
        return true;
    }

    if(textField == txtSTA)  {
        [txtElev becomeFirstResponder];
        return true;
    }

    if(textField == txtElev)  {
        [txtSiteDesc becomeFirstResponder];
        return true;
    }

    if(txtSiteDesc.isFirstResponder)  { 
        SQLite *db = [[SQLite alloc] init];
        [db saveSiteData:(UITextField *) txtSiteID sta:(UITextField *) txtSTA desc:(UITextField *) txtSiteDesc elev: (UITextField *) txtElev ];
        [txtSiteDesc resignFirstResponder];
        return true;
    }

    //  for readings
    if(textField == txtSTA1)  {
        [txtBS becomeFirstResponder];
        return true;
    }

    if(textField == txtBS) {
        [txtFS becomeFirstResponder];
        return true;
    }

    if(textField == txtFS)  {
        [txtDesc becomeFirstResponder];
        return true;
    }

    //    if(textField.isFirstResponder) {  
    if(textField == txtDesc) {  
        SQLite *db = [[SQLite alloc] init];
        [db saveReadings:txtSiteID sta:txtSTA1 bs:txtBS fs:txtFS desc:txtDesc];
        [txtDesc resignFirstResponder];
        return true;
    }

    return YES;
}

//    //--  is this for txtDesc 
//    if(txtDesc.isFirstResponder)  {
//        [txtDesc resignFirstResponder];
//    }
//

NSString *databasePath;
NSString *docsDir;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//--  save the site data
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- (BOOL) saveSiteData  {


    //  validate all fields
    if(txtSiteID.text.length == 0 || txtSiteDesc.text.length == 0)  {
        [self Alert:@"Missing Site ID and/or Description" andData:@"Reqired fields"];
        return NO;
    }

    if(txtSTA.text.length == 0 || txtElev.text.length == 0)  {
        [self Alert:@"Missing Initial STA and/or Elevation" andData:@"Reqired fields"];        
        return NO;
    }

    //    txtSiteDesc.text = txtSiteDesc.text.re  <----------  remove single quotes  TODO

    //  update d/b
    SQLite *dbCode = [[SQLite alloc] init];  //  instantiate slSQLite
    [dbCode saveSiteData:txtSiteID sta:txtSTA desc:txtSiteDesc elev:txtElev];  //  save site data

    return YES;
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//--  save the readings
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- (void) saveReadings  {

    //  update d/b
    SQLite *dbCode = [[SQLite alloc] init];  //  instantiate slSQLite
    [dbCode saveReadings:txtSiteID sta:txtSTA1 bs:txtBS fs:txtFS desc:txtDesc];

    return;
}

【问题讨论】:

    标签: objective-c xcode4


    【解决方案1】:

    我发现了问题... EnterDataVewController.m 的两 (2) 个实例位于不同的目录中在同一个项目中。我不知道为什么会导致问题,但是当我删除第二个实例时,它构建时没有任何问题(正常情况除外)。

    谢谢大家的建议。非常感谢您的宝贵时间。

    【讨论】:

      【解决方案2】:

      SQLite 是你自己独立的类吗...如果是,请导入它...如果不是,请尝试在其中导入 CoreData 框架

      【讨论】:

      • 是的,他只需要导入那个类的头文件。
      • 是的,它在一个单独的类中,是的,标题已经被导入。
      • 您是否链接到 libsqlite 将其添加到您的项目中?
      • 好的,最后一次尝试:阅读here,看看问题/解决方案是否适用于您的案例。
      猜你喜欢
      • 1970-01-01
      • 2013-06-25
      • 1970-01-01
      • 2011-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多