gpt4 book ai didi

ios - 代码 7 : linker command failed with exit code 1 (use -v to see invocation)

转载 作者:行者123 更新时间:2023-11-28 21:32:17 24 4
gpt4 key购买 nike

enter image description here

Ld /Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Products/Debug-iphonesimulator/UsingSegue.app/UsingSegue normal i386
cd "/Users/Abhinav/Desktop/Fist Project/UsingSegue"
export IPHONEOS_DEPLOYMENT_TARGET=9.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk
-L/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Products/Debug-iphonesimulator
-F/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Products/Debug-iphonesimulator
-filelist /Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/UsingSegue.LinkFileList
-Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.2 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -dependency_info -Xlinker /Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/UsingSegue_dependency_info.dat
-o /Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Products/Debug-iphonesimulator/UsingSegue.app/UsingSegue

duplicate symbol _OBJC_IVAR_$_NextViewController._NextArray in:
/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/ViewController.o
/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/NextViewController.o duplicate symbol _OBJC_CLASS_$_NextViewController in:
/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/ViewController.o
/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/NextViewController.o duplicate symbol _OBJC_METACLASS_$_NextViewController in:
/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/ViewController.o
/Users/Abhinav/Library/Developer/Xcode/DerivedData/UsingSegue-bujjpyciairreubqxbgfqixpwbiv/Build/Intermediates/UsingSegue.build/Debug-iphonesimulator/UsingSegue.build/Objects-normal/i386/NextViewController.o ld: 3 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经检查了我的编译源,那里没有重复项,但我仍然收到此错误。我是 IOS 的新手,请有人帮忙。我正在尝试在 View Controller 中创建数组,然后使用 segues 将其传递给另一个 View Controller 。

ViewController.m :

-(IBAction)click:(id)sender
{
self.ArrayInput = [[NSMutableArray alloc]init];
[self.ArrayInput addObject:@[_firstname.text]];
[self.ArrayInput addObject:@[_lastname.text]];
[self.ArrayInput addObject:@[_Email.text]];

NextViewController * nextcontroller = (NextViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"NextViewController"];
[self.navigationController pushViewController:nextcontroller animated:YES];

}

然后在 ViewController.m 中使用 segue:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NextViewController * NextVC = (NextViewController *)segue.destinationViewController;
NextVC.NextArray = [NSMutableArray arrayWithArray:self.ArrayInput];

}

NextViewController.m:

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:    (NSIndexPath *)indexPath
{
myTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myTableViewCell" forIndexPath:indexPath];
cell.Data.text = [self.NextArray objectAtIndex:indexPath.row];

return cell;

}

最佳答案

这个错误经常发生是不小心导入了 .m 文件而不是 .h

步骤:

  1. 检查 Target 设置中的构建阶段。
  2. 检查任何文件是否存在两次或一次。
  3. 如果文件存在两次,删除一个。

关于ios - 代码 7 : linker command failed with exit code 1 (use -v to see invocation),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35425628/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com