ios - j2objc 作为 XCode 中的子项目

标签 ios objective-c xcode macos

我在链接 j2objc 时遇到问题库作为子项目。它总是以“缺少 libjre_emul.a”错误结束。

我已完成的步骤:

1) 创建空的 iOS 项目

2) 按照 simple steps 包含 j2objc 库在“将 JreEmulation 项目包含到您的项目中。

我检查了我正在为 iPhone 模拟器构建并且构建过程正在运行。似乎 libjre_emul.a 是在 j2objc/jre_emul/build_result/处生成的,但它也应该在 DerivedData 中可用,但事实并非如此。我还尝试为 DerivedData 设置共享文件夹(文件 -> 项目设置 -> 派生数据 -> 高级),但这没有帮助。

我希望将其作为子项目包含的原因是能够在 j2objc 源代码中设置断点。

这里是错误:

Ld /Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/SubProject4.app/SubProject4 normal i386 cd /Users/user/Documents/Project1/SubProject4 setenv IPHONEOS_DEPLOYMENT_TARGET 6.1 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/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/iPhoneSimulator6.1.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator -F/Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator -filelist /Users/user/Library/Developer/Xcode/DerivedData/Build/Intermediates/SubProject4.build/Debug-iphonesimulator/SubProject4.build/Objects-normal/i386/SubProject4.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 /Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/libjre_emul.a -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/SubProject4.app/SubProject4

clang: error: no such file or directory: '/Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/libjre_emul.a'

最佳答案

汤姆·鲍尔 (Tom Ball) 在 j2obj google group 上回复:

The problem looks to be that the JreEmulation project's makefile is not copying the built library to where Xcode expects it to be. Xcode used to pass build environment variables like BUILT_PRODUCTS_DIR to external build system targets, but doesn't any more. Here's a workaround until I figure out how to fix embedding JreEmulation properly (if anyone has a solution, please reply):

  • Remove the red libjre_emul.a from your project's Link Binary with Libraries list.

  • In that list, click the + button, then Add Other...

  • Go to your j2objc directory, then dist/lib and add libjre_emul.a

Now when you look at the link list, libjre_emul.a should be red after cleaning your project (since it was deleted), and black after your project builds successfully.

所以这是一个错误,但我仍然无法调试/单步执行 j2objc 源代码。但至少这是有效的。

关于ios - j2objc 作为 XCode 中的子项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16656435/

相关文章:

iphone - 在 php for iphone(objective-c)中替代 print_r?

objective-c - UISplitViewController Master/Detail 通信

ios - 删除警告

ios - 在 Tab Swift 中使用页面 View Controller

ios - UIView.animateWithDuration 的交互式过渡完成 block 从未在 animateTransition 内部调用

ios - 如何使用 AudioKit 的新 AKSequencer 播放 MIDI

objective-c - 重新格式化以在新行中包含方法参数

objective-c - 您可以为plist文件定义自定义枚举类型吗?

Xcode6 Beta7 无法使用?

iphone - 为什么我的 OCMock 期望和 stub 在 iOS 5 中失败?