#5 exceptions on iphone-simulator 3.1

v1.0.3
closed-wont-fix
None
1
2010-11-20
2009-07-26
Tharit
No

When running hessiankit 1.0.3 in the iphone-simulator 3.1, the app crashes due to an doesNotRecognizeSelector exception.

I've tracked down the cause to the (Private) interface declarations. Seems like the iphone sdk is unhappy with the fact that the interface is split to two files, and behaves like the private methods don't exist at all.

I tried moving both the @interface and @implementation for CWDistantHessianObject and CWHessianArchiver and CWHessianUnarchiver to the respective .m files, and then the problem disappeared.

This problems only occurs with the iphone sdk, when building for osx eveything is fine.

Oh and btw, there seems to be a bug in CWHessianArchiver:classForClassName - that method is using _protocolTranslation instead of _classnameTranslation (thats not used anywhere at all).

Discussion

  • Fredrik Olsson
    Fredrik Olsson
    2009-08-10

    The problem is that the linker will remove aggressively unused methods. Unfortunately a but to aggressive for static libraries, as a result any method in a category is removed.

    The solution is to add the other linker flags "-ObjC", that will tell the compiler not to remove unreferenced Obj-C methods.

    This should be specified clearly in the documentation.

     
  • Fredrik Olsson
    Fredrik Olsson
    2009-08-10

    • labels: --> 1195475
    • milestone: --> v1.0.3
    • assigned_to: nobody --> peylow
    • status: open --> open-accepted
     
  • Fredrik Olsson
    Fredrik Olsson
    2010-11-20

    • priority: 5 --> 1
    • labels: 1195475 -->
    • status: open-accepted --> closed-wont-fix
     
  • Fredrik Olsson
    Fredrik Olsson
    2010-11-20

    This error is due to a bug in GCC compiler. Methods declared in a category are removed as unused if the target is a static library.

    Use the LLVM compiler to compile the static library. Or use HessianKit from source.