AliSoftware / OHAttributedLabel

UILabel that supports NSAttributedString
https://github.com/AliSoftware/OHAttributedLabel/wiki
1.51k stars 344 forks source link

Fixed iOS5 crash #155

Closed cristianbica closed 10 years ago

cristianbica commented 10 years ago

When using an app with OHAttributedLabel on iOS 5 it will crash with:

dyld: lazy symbol binding failed: Symbol not found: _NSTextAlignmentToCTTextAlignment
  Referenced from: /Users/cristi/Library/Application Support/iPhone Simulator/5.0/Applications/78925988-57FD-49D3-B088-0C9D80F462E1/OHAttributedLabelIOS5Bug.app/OHAttributedLabelIOS5Bug
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit

dyld: Symbol not found: _NSTextAlignmentToCTTextAlignment
  Referenced from: /Users/cristi/Library/Application Support/iPhone Simulator/5.0/Applications/78925988-57FD-49D3-B088-0C9D80F462E1/OHAttributedLabelIOS5Bug.app/OHAttributedLabelIOS5Bug
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit

That's because when using iOS6+ symbols you're checking for the base SDK

-#if __IPHONE_OS_VERSION_MAX_ALLOWED < 60000

and not for the deployment target

+#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0

Here's an example: https://github.com/cristianbica/OHAttributedLabelIOS5Bug To reproduce:

notes:

  1. I've added a podspec so the example project will work
  2. I've modified just in OHAttributedLabel/PrivateUtils/CoreTextUtils.m as this is where it crashed but probably we need to change this in the whole project
cristianbica commented 10 years ago

It seems that #149 fixes this also

AliSoftware commented 10 years ago

Ref #154

Will need to change that in the whole project indeed

drn commented 10 years ago

+1 - running into this as well looking forward to having an updated pod forking the pod for now...

AliSoftware commented 10 years ago

3.4.3 is out. Sorry it took so long.