xcode 架构 armv7 的未定义符号:“_SCNetworkReachabilityCreateWithAddress”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10930156/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:31:31  来源:igfitidea点击:

Undefined symbols for architecture armv7: "_SCNetworkReachabilityCreateWithAddress"

iphoneiosobjective-cxcodeframeworks

提问by Popeye

Right this has become a right pain I have been looking at it for 2 days now and can't seem to solve it. Here is the error I am getting.

是的,这已经成为一种正确的痛苦,我已经看了它 2 天了,似乎无法解决它。这是我得到的错误。

Undefined symbols for architecture armv7:
"_SCNetworkReachabilityCreateWithAddress", referenced from:
  +[Reachability reachabilityWithAddress:] in Reachability.o
"_SCNetworkReachabilityCreateWithName", referenced from:
  +[Reachability reachabilityWithHostName:] in Reachability.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
  -[Reachability stopNotifier] in Reachability.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
  -[Reachability startNotifier] in Reachability.o
"_SCNetworkReachabilitySetCallback", referenced from:
  -[Reachability startNotifier] in Reachability.o
"_SCNetworkReachabilityGetFlags", referenced from:
  -[Reachability connectionRequired] in Reachability.o
  -[Reachability currentReachabilityStatus] in Reachability.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have added SystemConfiguration.frameworkand it doesn't seem to want to do anything with it as this error just won't go away. I have looked at quite a few of the same problem but a lot of them done confirm any answers. This kind of just developed over the weekend when no one had touched it. Can anyone help.

我添加了SystemConfiguration.framework并且它似乎不想对它做任何事情,因为这个错误不会消失。我已经看过很多相同的问题,但其中很多都确认了任何答案。这种只是在没有人接触过的周末发展起来的。任何人都可以帮忙。

EDITForgot to add this bit.

编辑忘记添加这一点。

ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks//SystemConfiguration.framework/SystemConfiguration, missing required architecture armv7 in file

ld:警告:忽略文件/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks//SystemConfiguration.framework/SystemConfiguration,缺少必需的架构armv7在文件中

EDIT

编辑

Right Thanks to @gaige I have found a problem; there is an extra slash just before SystemConfiguration.framework that shouldn't be there. I have removed the framework and re-added and that has not helped. How can I remove this extra slash?

正确感谢@gaige 我发现了一个问题;SystemConfiguration.framework 之前有一个额外的斜线,不应该在那里。我已经删除了框架并重新添加,但这并没有帮助。我怎样才能删除这个额外的斜线?

采纳答案by Nate

Normally, extra slashes won't muck up a UNIX-like build process.

通常,额外的斜线不会破坏类 UNIX 的构建过程。

But, you do need to make sure the armv7architecture is inside the framework file that your build is trying to use. To do this, use the lipo -infocommand at the command line:

但是,您确实需要确保armv7架构在您的构建尝试使用的框架文件中。为此,请lipo -info在命令行中使用以下命令:

lipo -info /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer??/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks//SystemConfiguration.framework/Sy??stemConfiguration

You should see output like this:

你应该看到这样的输出:

Architectures in the fat file: SystemConfiguration are: armv6 armv7

If you don't, your project is probably set up to link to the wrong version of the SystemConfiguration.framework. There's multiple versions of that framework on your machine. So, I would verify the path of the framework (i.e. SystemConfiguration) that you have in your project.

如果不这样做,则您的项目可能设置为链接到错误版本的 SystemConfiguration.framework。您的机器上有该框架的多个版本。因此,我将验证您在项目中拥有的框架(即 SystemConfiguration)的路径。

Normally, I would expect that file to be something like this (adjusted for the OS version you're using):

通常,我希望该文件是这样的(针对您使用的操作系统版本进行了调整):

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Lib??rary/Frameworks/SystemConfiguration.framework

回答by peter_the_oak

I have had this problem for about 8 hrs with a Cordova project and the org.apache.cordova.network-informationplugin. By the answers above and several other answers, I was encouraged to search in the section Project > Target > Build Phases > Link Binary with Librariesof Xcode, which was right.

我在使用 Cordova 项目和org.apache.cordova.network-information插件时遇到了这个问题大约 8 小时。通过上面的答案和其他几个答案,我被鼓励在Project > Target > Build Phases > Link Binary with LibrariesXcode部分进行搜索,这是正确的。

But although SCNetworkReachabilityCreateWithAddressis defined in SystemConfigration.framework, I was not able to get rid of the linker errors by systematically adding and removing this and other libraries.

但是,尽管SCNetworkReachabilityCreateWithAddress在 中定义SystemConfigration.framework,但我无法通过系统地添加和删除此库和其他库来消除链接器错误。

Finally, I created a new project with the plugin and copied the framework constellation exactly as the original was. Now it's working.

最后,我使用插件创建了一个新项目,并完全按照原样复制了框架星座。现在它正在工作。

Conclusion:

结论:

  • If possible, create a new project with the necessary extensions and copy the constellations from it. It might help.
  • Sometimes, a library is too much included, so uncheck it. Sometimes it is the other way round.
  • To dig deeper, check the SystemConfiguration.frameworkas described in the outstanding answers above. It might mismatch the target architecture. Further, check for strange chars in build including paths.
  • 如果可能,创建一个带有必要扩展的新项目并从中复制星座。它可能会有所帮助。
  • 有时,包含的库太多,因此取消选中它。有时情况正好相反。
  • 要更深入地挖掘,请SystemConfiguration.framework按照上述优秀答案中的说明进行检查。它可能与目标架构不匹配。此外,检查构建中的奇怪字符,包括路径。

回答by Mona

I simply cleaned and restarted xcode and it worked.

我只是简单地清理并重新启动了 xcode,它就起作用了。