VitaliiBlagodir / cordova-plugin-datepicker

MIT License
318 stars 350 forks source link

iOS 6: XDK Build error: CompileXIB [...]/Resources/DatePicker.xib #143

Open jdinse opened 8 years ago

jdinse commented 8 years ago

With Intel XDK, when trying to build the app targeting iOS 6 and above, it aborts with an error:

CompileXIB [myproject].de/Resources/DatePicker.xib
    cd .../[myproject]app/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Developer/android-sdk-macosx/tools:/usr/local/ant/bin"
    export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
    /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --target-device iphone --target-device ipad --errors --warnings --notices --module [myproject]_de --minimum-deployment-target 6 --output-partial-info-plist .../[myproject]app/platforms/ios/build/[myproject].de.build/Release-iphoneos/[myproject].de.build/DatePicker-PartialInfo.plist --auto-activate-custom-fonts --output-format human-readable-text --compile .../[myproject]app/platforms/ios/build/device/[myproject].de.app/DatePicker.nib .../[myproject]app/platforms/ios/[myproject].de/Resources/DatePicker.xib
/* com.apple.ibtool.document.errors */
.../[myproject]app/platforms/ios/[myproject].de/Resources/DatePicker.xib:CHZ-tf-She: error: Auto Layout on iOS Versions prior to 6.0
.../[myproject]app/platforms/ios/[myproject].de/Resources/DatePicker.xib:SUg-U1-bKY: error: Auto Layout on iOS Versions prior to 6.0
.../[myproject]app/platforms/ios/[myproject].de/Resources/DatePicker.xib:xq4-6B-F5W: error: Auto Layout on iOS Versions prior to 6.0
.../[myproject]app/platforms/ios/[myproject].de/Resources/DatePicker.xib:1: error: Auto Layout on iOS Versions prior to 6.0
.../[myproject]app/platforms/ios/[myproject].de/Resources/DatePicker.xib:b2J-jW-BgT: error: Auto Layout on iOS Versions prior to 6.0
.../[myproject]app/platforms/ios/[myproject].de/Resources/DatePicker.xib:FEs-Wn-Ur2: error: Auto Layout on iOS Versions prior to 6.0

It works when setting the target to iOS 7 and above.

Any ideas?

jdinse commented 8 years ago

Ok, I found out that the plugin doesn't really need the AutoLayout-Option.

Inside of the plugin, I simply opened src/ios/DatePicker.xib with Xcode and unchecked the option "Use Auto Layout" which removed the attribute useAutoLayout="YES" from the document tag. And voila: Building the app for iOS 6 works perfectly.

jdinse commented 8 years ago

I posted the question in Intel XDK's forum as well. Someone from Intel says that the plugin does not handle all the necessary cases for using Auto Layout in iOS 6.

https://software.intel.com/de-de/forums/intel-xdk/topic/604018#comment-1852186

filipe-nunes commented 8 years ago

@jdinse Nice job on the AutoLayout-Option. Yet I found a bug in, at least, the iphone 5s, where on the second time I called the plugin the background would fade darker (ok until here), but the datepicker would never show. If anyone bumps into this issue, the solution is: DatePicker.m, -showForPhone: replace CGRect frame = self.datePickerComponentsContainer.frame for CGRect frame = CGRectMake(0, height - self.datePickerComponentsContainer.frame.size.height, self.datePickerComponentsContainer.frame.size.width, self.datePickerComponentsContainer.frame.size.height); I believe the issue was that the datePickerComponentsContainer's frame would be in the appropriate Y destination coordinate after the first show animation (due to its creation, probably). But on the second time, the Y destination would be the end of the screen, therefore it would never showup again.