When building an iOS project with Cordova the setting that allows web views to bounce will be turned on by default, resulting in an effect while scrolling that can look ugly, like so:
Since Cordova versions 1.5+ the
cordova.plist file has been replaced with the
config.xml that you find in the root directory of your Cordova project. This is where you set the configuration property to inform iOS to disable web view bouncing.
Instead of editing a plist file in XCode, instead we will add the configuration to the
/your-project/config.xml file. Open this file with a text editor and add the line to the end of the
<widget> block, before the final
<preference name="DisallowOverscroll" value="true" />
Now rebuild the iOS application from the terminal.
cordova build ios
When you next run the application in XCode on a simulator or device, the bouncing problem will be solved.
For example this can often happen with the Cordova
SplashScreen plugin. See the screenshot below and ensure that the
.m implementation file has a checkmark on the "Target Membership" option for your application.
Only the implementation file should have the target membership checked (so not the
.h header file).
This is often the reason why a plugin appears simply not to work. It's always good to check this setting first before debugging further.
While working on my mobile application Elite Ice Hockey Action, I recently released an update and discovered that I need to add new App Store screenshots for the iPhone 6 and 6+.
Based on the App Store screenshot guidelines the images uploaded should not contain the iOS status bar (containing the time, battery level etc.). However, when using the iOS simulator for taking screenshots the status bar is always visible and simply cutting it out in Photoshop or Preview is not an option because since the iPhone 6 was released the screenshot dimensions must be exactly the same as the iPhone it was taken on.
There appears to be no way to simply turn off the status bar from the iOS simulator so my only option is to temporarily hide the status bar programmatically in Xcode and then disable this effect again after gathering my images.
Read on to find out the steps I performed to achieve this goal.
In Cordova 3.5+ you may experience an error while trying to build the iOS platform stating a precompiled header has been modified and needs to be rebuilt.
This is usually caused by deleting an existing Cordova project and rebuilding it in the same directory.
fatal error: file '/Users/blake.simpson/cordova/del-app/platforms/ios/DEL Action/DEL Action-Prefix.pch' has been modified since the precompiled header '/var/folders/bq/1p80g4q56tl2zmcv96c3r3g9fw6s01/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/DEL Action-Prefix-edciowciqplpzxaziffeqsjfaaka/DEL Action-Prefix.pch.pch' was built note: please rebuild precompiled header
'/var/folders/bq/1p80g4q56tl2zmcv96c3r3g9fw6s01/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/DEL Action-Prefix-edciowciqplpzxaziffeqsjfaaka/DEL Action-Prefix.pch.pch'
1 error generated.
The simple option is to delete the existing
.pch file. In the previous example that would be done in the terminal by using
$ rm /var/folders/bq/1p80g4q56tl2zmcv96c3r3g9fw6s01/C/com.apple.DeveloperTools/6.0.1-6A317/Xcode/SharedPrecompiledHeaders/DEL\ Action-Prefix-edciowciqplpzxaziffeqsjfaaka/DEL\ Action-Prefix.pch.pch
Once deleted rebuild the iOS project.
$ cordova build ios