iphone - 构建失败 : symbol(s) not found

标签 iphone objective-c xcode linker

iTunes 拒绝了我的应用,所以我必须修改它。我正在这样做,但现在我无法在模拟器上启动该应用程序:

Ld /Users/user/Library/Developer/Xcode/DerivedData/emars-hgjxnbewvbrekiepjbfkvodcrvtk/Build/Products/Debug-iphonesimulator/emars.app/emars normal i386
    cd "/Users/user/TRAVAIL/MMW/iphone application V1.0/e-mars"
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/emars-hgjxnbewvbrekiepjbfkvodcrvtk/Build/Products/Debug-iphonesimulator -F/Users/user/Library/Developer/Xcode/DerivedData/emars-hgjxnbewvbrekiepjbfkvodcrvtk/Build/Products/Debug-iphonesimulator -filelist /Users/user/Library/Developer/Xcode/DerivedData/emars-hgjxnbewvbrekiepjbfkvodcrvtk/Build/Intermediates/emars.build/Debug-iphonesimulator/emars.build/Objects-normal/i386/emars.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Objc -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework SystemConfiguration -lz.1.1.3 -o /Users/user/Library/Developer/Xcode/DerivedData/emars-hgjxnbewvbrekiepjbfkvodcrvtk/Build/Products/Debug-iphonesimulator/emars.app/emars

到此结束:

Undefined symbols for architecture i386:
  "_OBJC_IVAR_$_UIViewController._title", referenced from:
      -[FirstViewController viewDidLoad] in FirstViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

也许它需要一个我没有包含的库(我已经停止处理库了很多)...

编辑:错误来 self 更改的新代码,因为如果商店拒绝该应用

这是我的代码(运行但被 ItunesConnect 拒绝)

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Login et mot de passe" message:@"" delegate:self cancelButtonTitle:@"Annuler"  otherButtonTitles:@"Sauvegarder", nil];
        [alertView addTextFieldWithValue:@"" label:@"Login"];
        [alertView addTextFieldWithValue:@"" label:@"Mot de passe"];
        // Username
        textfieldName = [alertView textFieldAtIndex:0];
        textfieldName.keyboardType = UIKeyboardTypeAlphabet;
        textfieldName.keyboardAppearance = UIKeyboardAppearanceAlert;
        textfieldName.autocorrectionType = UITextAutocorrectionTypeNo;
        // Password
        textfieldPassword = [alertView textFieldAtIndex:1];
        textfieldPassword.clearButtonMode = UITextFieldViewModeWhileEditing;
        textfieldPassword.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
        textfieldPassword.keyboardAppearance = UIKeyboardAppearanceAlert;
        textfieldPassword.autocorrectionType = UITextAutocorrectionTypeNo;
        textfieldPassword.secureTextEntry = YES;
        [alertView show];

这是出现此错误的代码:

// Ask for Username and password.
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:_title message:@"\n \n \n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];

        // Adds a username Field
        textfieldName = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)]; 
        textfieldName.placeholder = @"Login";
        [textfieldName setBackgroundColor:[UIColor whiteColor]];
        textfieldName.enablesReturnKeyAutomatically = YES;
        [textfieldName setReturnKeyType:UIReturnKeyDone];
        [textfieldName setDelegate:self];
        [alertView addSubview:textfieldName];


        Show alert on screen.
        [alertView show];
        [alertView release];

谢谢你的帮助!

最佳答案

_title 不是可使用的有效 ivar。它在 UIViewController 中定义,这就是为什么您没有收到未定义错误的原因,但它被声明为 @package 这意味着它是内部的。简而言之,不要使用 _title

关于iphone - 构建失败 : symbol(s) not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9077736/

相关文章:

ios - 当页面更改时,我的 UIPageViewController 中的下一页仅部分加载

iphone - 在 UIWebView 中指定 HTTP 引用

iphone - Spotify Simple Player 示例和 libspotify

iphone - Objective-C - for 循环中的未识别错​​误

ios - 创建从容器 View 到 View Controller 的引用(IBOutlet)

iphone - 从 NSDictionary 中提取 CGFloat 的语法

iphone - UIWebview 调整高度以适应内容

iphone - 当标题、左按钮和右键已经存在时,将 UISearchBar 放入 UINavigationBar

ios - 快速通过 UITextField 的 UILongPressGestureRecognizer

objective-c - 将 NSDecimalNumber 转换为 NSString