Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
451 views
in Technique[技术] by (71.8m points)

xcode4 - PLCrashReporter in XCode 4 - won't compile in Simulator

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...