bthurlow / nativescript-maskedinput

A {N} masked input plugin for iOS and Android
Other
8 stars 8 forks source link

[iOS] App crashing #7

Open NordlingDev opened 7 years ago

NordlingDev commented 7 years ago

Platform: iOS TNS: 2.3.0

Getting this error:

file:///app/tns_modules/ui/builder/builder.js:162:56: JS ERROR Error: Building UI from XML. @file:///app/views/test/test.xml:5:5 ↳UIColor.blackColor is not a function. (In 'UIColor.blackColor()', 'UIColor.blackColor' is an instance of UIColor)

... when adding this:

<Page xmlns:mi="nativescript-maskedinput">
  <mi:MaskedInput mask="1-999-999-9999? x999" hint="1-555-555-5555" placeholder="#" />
</Page>
NordlingDev commented 7 years ago

Got help at NativeScript git:

The given error has been caused due to the fact that with Xcode 8 some of the methods now are properties. While the author fix this in the plugin you could replace the following line in node_modules/nativescript-maskedinput/maskedinput.ios.js file the following line:

this.ios.textColor = this.ios.textColor ? this.ios.textColor.colorWithAlphaComponent(0.22) : UIColor.blackColor().colorWithAlphaComponent(0.22);

with

this.ios.textColor = this.ios.textColor ? this.ios.textColor.colorWithAlphaComponent(0.22) : UIColor.blackColor.colorWithAlphaComponent(0.22);

Source: https://github.com/NativeScript/NativeScript/issues/2839#issuecomment-251385801

So it's an Xcode 8 issue that needs fixing :)