I'm updating my PhoneGap iOS-app to make it compatible with the iPhone 5.
I'm manually hiding the splash screen after my app has initialized.
When simulating iPhone 5: When the app starts it displays the correct splash screen (Default-568h#2x.png) (hereon "the 5") but quickly hides it and instead displays the iPhone 4 splash screen (hereon "the 4"). The 4 doesn't cover the whole app, thus showing top and bottom bars of the app initializing.
I'm not entirely sure how it works but I can think of two possible scenarios:
1) Both images are displayed simultaneously but for some reason the 5 auto hides while the 4 waits for the call from the app to hide.
2) At some point when disabling manually hiding the splash screen phonegap switches out the "true" splashscreen for a "fake" one that is displayed until the javascript call from the app and phonegap just might not display correct one after this switcheroo.
Has anyone else encountered and / or solved this?
UPDATE:
Tried removing and adding all splash images again but to no avail. I tried removing the smaller images (the 4 and its non-retina version) but even without the smaller ones present anywhere in the project I get the same error!
UPDATE 2:
Cordova 2.2.0 has now been released, thus fixing this issue according to: http://shazronatadobe.wordpress.com/2012/10/27/whats-new-in-cordova-ios-2-2-0/
So, the recommended solution would therefore be to update your app to use Cordova 2.2.0, if that is for some reason not possible, solutions are provided below.
I've received two answers elsewhere but haven't had time to test them out yet:
From user T123 in the Phonegap Google Group:
open CDVViewController.m -- find - (void) showSplashScreen
change about line: 690
From :
else // not iPad
{
orientedLaunchImageFile = launchImageFile;
}
To:
else // not iPad
{
orientedLaunchImageFile = launchImageFile;
/* Edited for 4-inch IP5 */
if(screenBounds.size.height == 568)
orientedLaunchImageFile = [NSString stringWithFormat:#"%#-568h", launchImageFile];
}
And from Brion who commented above, the following pull request, hoepfully to be incorporated into Cordova 2.2.0: https://github.com/apache/incubator-cordova-ios/pull/50
EDIT: Tried T123's solution and it's working for me!
EDIT2: Brion's fix was incorporated in Cordova 2.2.0 which has now been released!
EDIT3: Just updating to highlight a comment for those who don't bother reading them:
For Phonegap version 1.4.1, I managed to get Hessius's fix to work like this: I copied the methods showSplashScreen, isIPad, resolveImageResource and the definition #define degreesToRadian(x) (M_PI * (x) / 180.0) from the file PGViewController.m to my MainViewController.m file. After that, XCode complained that I was assigning values to read-only attributes, so I edited the header file in PhoneGap.framework to make those two attributes readwrite. I also changed launchImageFilefrom Hessius's code to #"Default". This did the trick for me. – Joe Dyndale Oct 8 '12 at 15:23
The fix for this (https://issues.apache.org/jira/browse/CB-1482) is not out until 2.2. It is very risky to use the unstable version and I don't bother to compile from source code myself, so I tried the following hack:
In MainViewController.m
- (void) showSplashScreen
{
CGRect screenBounds = [[UIScreen mainScreen] bounds];
// HACK: PhoneGap pre-2.2 does not support iphone5 splash image well, so we just skip it
if (screenBounds.size.height == 568) {
return;
}
[super showSplashScreen];
}
This will disable showSplashScreen for iPhone5 to avoid the shorter launch image added by PhoneGap (iOS initial launch image is showing up fine). It worked for me and I barely notice any difference by hacking off showSplashScreen for iPhone5.
White Flicker
I was having this same problem with Cordova 2.2. I think it is worth mentioning that I had to take an added step in order to get the splash screen to render correctly.
I made the changes that were included in #Hessius answer. But I noticed that a white screen flash was produced after the splash screen appeared.
In the (void)showSplashScreen method others may see
if (launchImageFile == nil) { // fallback if no launch image was specified
// if (CDV_IsIPhone5()) {
// // iPhone 5 or iPod Touch 6th-gen
// launchImageFile = #"Default-568h";
// } else {
launchImageFile = #"Default";
// }
}
Commenting the code out(or removing) that I have commented, eliminated the white flicker I was seeing in between app load and launch screen.
Hope this helps someone!
Related
I'm having an issue with textfields in Sencha Touch 2, this is only occurring in iOS 7 and working fine in iOS 6 and Android.
The issue is when you tap a field the keypad opens but the cursor disappears, it should be focus on selected textfield but it does not. You have to tap the textfield again to focus.
I have checked this issue on iOS 6 and android (on devices as well as on simulators), working fine but not on iOS 7 only.
Is anybody having this issue...?
Is this a bug in sencha or should i missing something, please advice.
Thank you..
I have found this to be directly related to two things:
centered: true
pack: 'center'
When I removed those lines, my app started playing nice. The challenge is to find an alternative way to center your panels.
I spent days figuring this out. Actually there is a problem with Sencha understanding the ViewPort height. In your index.html add a script block with the following code
if (window.device && parseFloat(window.device.version) == 7.0) {
document.body.style.paddingTop = "20px";
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}
This does two things for you
It Provides enough space on Top to display the activity bar
It sets the Viewport height to be that of screen height, irrespective of the keyboard being present or not.
Also, If your app works in Portrait and Landscape mode, you will need to add these lines in your Viewport.js (or Main.js)
initialize: function(){
Ext.Viewport.on('orientationchange', 'handleOrientationChange', this, {buffer: 0 });
},
handleOrientationChange: function(){
try{
if (parseFloat(window.device.version) == 7.0) {
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}else{
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight());
}
}catch(e){
// do nothing
}
},
And Yes, Make sure they Keyboard Bounce is TRUE in true (if you are using cordova). This will make sure your field does not get hidden.
Hope this works for you.
add height="device-height" in viewport meta tag, fixes the issue.
ios7 issues with webview focus when using keyboard html
As you can see, the simulator misses text on some buttons. I also saw this same behavior following along on the TapCounter demo off of YouTube.
Another issue (not shown in the screenshot) is that if you press on any key on TapCounter, NSString stringWithFormat (see below)
- (IBAction)add {
count++;
number.text = [NSString stringWithFormat:#"%i", count];
}
The act of executing the stringWithFormat line nukes the formatting on the label and reverts it to default value.
I did make sure that the simulator size and development size are identical, as you canm see.
This question appears a few times on this site. The answer at this related question worked for me, once I was able to interpret the instructions. Including getting the crash and fixing it.
Later: it appears that the fix of turning off auto-layout is enough to get the 6.0 simulator working - you might like to try this first to see if all the other stuff is actually necessary...
I have a mobile web application, working well on simulator 5.1/6.0, xcode 4.5 for iphone.
But when I test on a real device (3gs, ios 5.1), I get a strange behavior: anywhere I place an input field html element, where I need the user to fill in something, I tap the field, it gains focus (I see the cursor), but the touch-keyboard does not come up and I can't type anything. If I try it on the sim, all is fine, the kb comes up.
I am not sure how to diagnose this... tried googling for some answers, haven't found any :(
any ideas?
thanks...
ok found the issue, seems like the app was not created using the latest Xcode template (it is a legacy app), so I removed the MainWindowxxx.xibs which I don't need, and used the code from a new XCode app template to initialize the app by programmatically creating the main view controller, and setting it as the window's rootViewController. And, of course, call [self.window makeKeyAndVisible]
I'm using Xcode 4.3.1 with Phonegap 1.4.1 to build an iPhone app. Whenever I tap the status bar to scroll to top, the app crashes with an EXC_BAD_ACCESS error.
I've tried implementing a number of suggestions such as this
.
I've also tried adding variations of the below code:
[[[theWebView subviews] objectAtIndex:0] setScrollsToTop:NO];
((UIScrollView*)[theWebView.subviews objectAtIndex:0]).scrollsToTop = NO;
to the
- (void) webViewDidFinishLoad:(UIWebView*) theWebView
{
...
}
within the AppDelegate.m
However, I've have been unable to resolve the issue. My main concern is to stop the app form crashing, any insight would be greatly appreciated.
I am using cordova 1.7 and have the same problem. I found a workaround though. You need to patch phonegap by commenting out the creation of invsible iframe which is injected by phonegap to communicate with the native side. In fact, this iframe causes all kinds of rendering issues, not only the status bar problem:
if (cordova.commandQueue.length == 1 && !cordova.commandQueueFlushing) {
// if (!gapBridge) {
// createGapBridge();
// }
// gapBridge.src = "gap://ready";
location = "gap://ready";
}
I didn't find any side effects after I've made the above change. However, I know people complain that some plugins stopped working, e.g. google analytics.
I'm having a strange problem while debugging my Blackberry Application on a real device (BB Bold 9700). When I debug the same application within the BB emulator, the app runs fine, but when I run it on the real device, the app behaves differently (custom painting goes completely wrong). What's even worse is that my Eclipse environment seems to be unable to view live objects correctly while being at a break point (debug time).
I've added a screenshot to illustrate the strange behaviour:
As you can see, the app stops at the breakpoint within the IF statement, but the Variables pane says that the variable "methodName" equals null. Moreover, when I want to look at the variable "methodArguments" which is of type org.json.me.JSONArray, it says "details unavailable - not supported by VM".
Does anyone know what's going on here? My app works great on the emulator, but it's currently useless on the real device.
Thanks in advance!
I think I fixed it:
The problem was that I was laying out Fields on a manager that wasn't yet added to the viewstack.
What did the trick for me was overriding onDisplay() in the manager that contained the Fields that were displayed wrong:
protected void onDisplay()
{
//Make sure superclass is called
super.onDisplay();
/*You have to call "this.setDirty(true)" when you perform layout on a
*manager that isn't added to the viewstack. Then you can use
*"this.isDirty()" to determine whether you need to re-layout the fields
*when the manager becomes visible.*/
if(this.isDirty())
{
//I'm not sure if I need to use "invokeAndWait" and not "invokeLater"
UiApplication.getUiApplication().invokeAndWait(new Runnable()
{
public void run()
{
for (int i = 0; i < getFieldCount(); i++)
{
/*This (custom) function makes sure the Field gets its
*size and position*/
layoutItem(getField(i));
}
}
});
//Make sure you set "dirty" to false, to make sure this only happens once
this.setDirty(false);
}
}
If anyone has a better solution, I'd be glad to hear it (and maybe improve my app).
org.json.me.JSONArray, it says "details unavailable - not supported by VM".
the JSON related stuff is not available on device running 4.5 and 4.6 BB OS. Import it into the code.
Download it from here.
https://github.com/douglascrockford/JSON-java
it is available as Open Source and then use it into your applications.