gpt4 book ai didi

ios - `duplicate symbol _main` Swift AppDelegate

转载 作者:可可西里 更新时间:2023-10-31 23:58:15 26 4
gpt4 key购买 nike

我正在尝试将我的 iOS 应用程序转换为 Swift。一切都很顺利,直到我尝试用 .swift 等效项替换我的 AppDelegate.m/.h。现在,在构建时,出现以下错误:

Ld /Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Products/Debug-iphonesimulator/Bowdoin\ Dining.app/Bowdoin\ Dining normal i386
cd "/Users/ruben/Workspace/Development/Objective-C/Bowdoin Dining"
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode6-Beta2.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -L/Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Products/Debug-iphonesimulator -F/Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Products/Debug-iphonesimulator -filelist /Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Intermediates/Bowdoin\ Dining.build/Debug-iphonesimulator/Bowdoin\ Dining.build/Objects-normal/i386/Bowdoin\ Dining.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -lxml2 -lswift_stdlib_core -L/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -force_load -Xlinker /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a -Xlinker -sectalign -Xlinker __SWIFT -Xlinker __ast -Xlinker 4 -Xlinker -sectcreate -Xlinker __SWIFT -Xlinker __ast -Xlinker /Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Intermediates/Bowdoin\ Dining.build/Debug-iphonesimulator/Bowdoin\ Dining.build/Objects-normal/i386/BowdoinDining.swiftmodule -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.0 -lz.1.2.5 -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework CoreGraphics -framework Foundation -framework UIKit -Xlinker -dependency_info -Xlinker /Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Intermediates/Bowdoin\ Dining.build/Debug-iphonesimulator/Bowdoin\ Dining.build/Objects-normal/i386/Bowdoin\ Dining_dependency_info.dat -o /Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Products/Debug-iphonesimulator/Bowdoin\ Dining.app/Bowdoin\ Dining

和:

duplicate symbol _main in:
/Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Intermediates/Bowdoin Dining.build/Debug-iphonesimulator/Bowdoin Dining.build/Objects-normal/i386/AppDelegate.o
/Users/ruben/Library/Developer/Xcode/DerivedData/Bowdoin_Dining-eevtozmixiiwpkdhanzlqfsrhfxr/Build/Intermediates/Bowdoin Dining.build/Debug-iphonesimulator/Bowdoin Dining.build/Objects-normal/i386/main.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这个错误看起来很普通并没有多大帮助...但这就是我真正得到的。这似乎是在我将 import "AppDelegate.h int main.m 切换为 import "MyAppName-Swift.h" 之后发生的。有没有人知道为什么会这样吗?谢谢。

最佳答案

您可以完全放弃 main.m。只需在应用委托(delegate)的类声明上方的行中添加 @UIApplicationMain 即可指定应用程序的入口点。

关于ios - `duplicate symbol _main` Swift AppDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24807997/

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