PLCrashReporter in XCode 4 - won't compile in Simulator

余生颓废 提交于 2019-12-29 05:26:25

问题


I must be doing something totally stupid here, but I can't get the PLCrashReporter framework included in my project. Here are the steps I took to get the framework:

  1. Downloaded the .dmg file from the official project site on google code
  2. Copied the CrashReporter.framework folder to the root directory of my project
  3. Added the framework by going to my project, selecting the target, going to the Build Phases tab, opening the Link Binary With Libraries section, clicking the plus sign, and adding the CrashReporter.framework folder

I am pulling in the framework in my class file by using

#import <CrashReporter/CrashReporter.h>

When I try to compile under 4.3 simulator, I get the following errors:

Undefined symbols for architecture i386: "_OBJC_CLASS_$_PLCrashReporter", referenced from: objc-class-ref in AppDelegate+CrashReporting.o "_OBJC_CLASS_$_PLCrashReport", referenced from: objc-class-ref in AppDelegate+CrashReporting.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

When I compile under the device, everything is fine. Is there some sort of header or library search path I need to include?

The app compiles under XCode 3 without issues under all configurations.


回答1:


I had the same issue and was able to resolve it. Here are the steps I completed...

  1. Download the PLCrashReporter source release and unzip.
  2. Open the PLCrashReporter xcode project. This project is setup to use an old SDK, update all the required SDKs for each target to get rid of the warnings. This is also required to compile in the next step.
  3. Navigate to the CrashReporter-iPhoneSimulator Target. Under the Build Settings: a) set "Perform Single-Object Prelink" to "No", b) set "Mach-O Type" to "Static Library".
  4. Select CrashReport-iPhoneSimulator : [IOS simulation (ie iPhone 4.3 Simulator)] and click build.
  5. Navigate to your build directory for the PLCrashReporter. For me, it was /Users/username/Library/Developer/Xcode/DerivedData/CrashReporter-(random characters)/Build/Products/Debug-iphonesimulator
  6. Copy the libCrashReporter-iphonesimulator.a from the build directory in step 5 to the iphone application project directory you want to add the crash reporter to.
  7. Open the your iphone application project in xcode.
  8. Download the PLCrashReporter binary release and extract the framework to a local directory.
  9. Add the CrashReporter framework to your project using this SO post.
  10. Following the same procedure as step 9, add the libCrashReporter-iphonesimulator.a static library to the "Link Binary with Libraries" section of the build phases. No *.framework directory is needed when adding a static library.
  11. Review the "Link Binary with Libraries" in the Target. Make sure the libCrashReporter-iphonesimulator.a is listed above the CrashReporter framework. You can drag and drop to reorder.

I hope this helps.




回答2:


For anyone else looking for this information:

I followed the same steps given above however I was getting errors. I deleted the static library and only included the framework (which you can get from their dmg).

It worked perfectly for me. I think the process of creating static library by building the project was old (before they created a framework).

Thanks.




回答3:


Don't forget to include

libstdc++.dylib

in "Link Binary With Libraries".



来源:https://stackoverflow.com/questions/6192897/plcrashreporter-in-xcode-4-wont-compile-in-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!