hackiftekhar / IQKeyboardManager

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.
MIT License
16.46k stars 2.41k forks source link

Crash on build with release mode at device and simulator #111

Closed retsohuang closed 9 years ago

retsohuang commented 9 years ago

Here is screenshot screen shot 2014-11-05 at 11 29 44 pm

Two method call have this issue

UITableViewCellScrollViewClass      = NSClassFromString("UITableViewCellScrollView")
EKPlaceholderTextViewClass          = NSClassFromString("EKPlaceholderTextView")
hackiftekhar commented 9 years ago

Could you please share your configuration? mean Xcode version, iOS version etc?

retsohuang commented 9 years ago

Xcode 6.1 and iOS 8,only swift project. The private UITableViewCellScrollView from the table cell seems is gone. https://github.com/CEWendel/SWTableViewCell/issues/170

Spilly commented 9 years ago

I have the same issue. Works on debug, but on release crashes for those two method calls. I am using Xcode 6.1 and support iOS 7 and iOS 8.

padotj commented 9 years ago

Xcode 6.1 and OS 8.1. I'm having the same problem building for release. Works in debug.

hackiftekhar commented 9 years ago

Fixed UITableViewCellScrollView class check and other checks also, but wondering the library is working fine in debug mode and still crashes somewhere in release configuration. :(

hackiftekhar commented 9 years ago

Changing "Optimization Level" in Build Settings solved the problem:- http://stackoverflow.com/questions/3327981/app-runs-as-debug-but-crashes-as-release http://www.mindjuice.net/2011/11/30/how-to-fix-an-app-that-crashes-in-release-but-not-debug

But I'm still worried about it. If somebody has suggestions, I would love to hear.

hdoria commented 9 years ago

+1 for this.

WadeSellers commented 9 years ago

Is this last bug still an issue? I'd like to use but fear the issue discovered upon release is still not resolved.

hackiftekhar commented 9 years ago

Yes, it still an issue and I can't do anything for this. This is beyond my control. All compilation process goes to LLVM compiler.

WadeSellers commented 9 years ago

Ok I see. Yet, this should work just fine when my app would go to the App Store and downloaded, etc. Right? It's just the internal issue but it doesn't effect the outcome once the app is available for consumer download I imagine.

hdoria commented 9 years ago

I'm really worried about this process. Is there anything we could do to fix this?

hackiftekhar commented 9 years ago

A workaround to change optimization level in settings, but for a fix I'm unable to debug code to find the exact problem. If someone can help or suggest me something, I love to hear.

ronaldsmartin commented 9 years ago

I've had issues with NSClassFromString() in optimized builds (while not using IQKeyboardManager) in some of my Swift-only apps. Using objc_getClass() instead was what fixed my problem. Hope that helps.

About to try this pod out- it looks great! Thanks for sharing your efforts!

hackiftekhar commented 9 years ago

How did you replace NSClassFromString() with objc_getClass()? Can you share a sample code?

ronaldsmartin commented 9 years ago

In Swift, both functions have the same type signature, so you can just replace the function name.

Example (checking class availability in Swift):

if NSClassFromString("UIAlertController") == nil { // original
    ...
}

You would use:

if objc_getClass("UIAlertController") == nil { // replacement
    ...
}

In Obj-C, I think it would just be objc_getClass("UIAlertController") instead of NSClassFromString(@"UIAlertController") since objc_getClass takes a const char *name.

hackiftekhar commented 9 years ago

It seems As on Xcode 6.3 (Swift 1.2) this crash is not happening in release mode. @retsohuang , @Spilly , @padotj , @hdoria , @Waderoni , @ronaldsmartin , @mythodeia can some of you test the current Swift version with Xcode 6.3 (Swift 1.2) and let me know if it's still hapenning. If it's not happening then I would love to update Swift Version to match latest ObjC version of library.

hdoria commented 9 years ago

It's not happening anymore. I'm running fine with Xcode 6.3 and Swift 1.2.

mythodeia commented 9 years ago

fine on my end as well

hackiftekhar commented 9 years ago

So closing this issue, because this was not relevant to the library and it relevant to Apple Implementation of LLVM compiler.

mihirpmehta commented 9 years ago

if this bug is already fixed. Can you fix the ReadME file. because read me file says it is still known issie in swift

hackiftekhar commented 9 years ago

Thanks for reminding me. Will surely update. Thanks :)

hackiftekhar commented 9 years ago

Readme updated