• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Einige Blicke in fremde Welten dürft Ihr nun bestaunen und darüber abstimmen, welche davon Euch am meisten gefällt: hier geht es lang für Euer Voting --> Klick

iPad WebView Application reloadet nicht zuverlässig iPad oder PHP?

Chriis

Dithmarscher Paradiesapfel
Registriert
25.01.10
Beiträge
1.467
Liebe ATer,

Ich habe ein Problem.
Ich habe mir eine WebView Application für iPad geschrieben. Diese WebView App zeigt eine Website an, die mit PHP arbeitet.
Diese Seite wird automatisch nach 40 Sekunden reloadet. (Beispielsweise - das soll hinterher einstellbar sein).
Nur wirklich zuverlässig läuft der Reload nicht. Mal funktioniert er eine halbe Stunde und dann mal eine Zeit nicht.
Auch ist es passiert, dass mal ein Bild nicht angezeigt worden ist. Ich kann das absolut nicht rekonstruieren, weil es ja auch ne halbe Stunde läuft ohne Probleme.

Daher meine Frage - liegt das am PHP, am JavaScript welches den Reload durchführt, oder an der App Programmierung?

Meine Index.html
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<script src='http://code.jquery.com/jquery-1.4.2.min.js' type='text/javascript'></script>
<script src='jquery.divslideshow-1.2-min.js' type='text/javascript'></script>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
	setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


<title>Test</title>
</head>


<body onload="JavaScript:timedRefresh(40000);" style="background-image:url(back.jpg)">




<script>
    $(document).ready(function(){
	    $('#slideshow').divSlideShow(
	    	{width:1024, height:768, arrow:'split', controlClass:'custom', delay: 10000});
	    });
</script>


<div id='slideshow' style="height:768px; overflow:hidden;">
    <div class='slide'><iframe src="seite.php" height="768px" width="1024px" frameborder="0" scrolling="no"></iframe></div>
    <div class='slide'><iframe src="seite.php" height="768px" width="1024px" frameborder="0" scrolling="no"></iframe></div>
    <div class='slide'><iframe src="seite.php" height="768px" width="1024px" frameborder="0" scrolling="no"></iframe></div>
    <div class='slide'><iframe src="seite.php" height="768px" width="1024px" frameborder="0" scrolling="no"></iframe></div>
</div>


</body>
</html>

Meine Seite.php:
Code:
<?php // WebYep init WebYepV1
/* ><table><tr><td bgcolor=white><h2>WebYep meldet: Fehler, PHP inaktiv</h2>
<font color=red>Der PHP-Code in dieser Seite wird nicht durchgef&uuml;hrt!<ul>
<li>Entweder rufen Sie die Seite nicht &uuml;ber den WebServer sondern direkt
von Ihrer Festplatte aus auf (zB. mittels &quot;Voransicht im Browser&quot; im Dreamweaver).</li>
<li>Oder Sie haben der Datei nicht die richtige Dateierweiterung (extension) gegeben -
WebYep-Seiten m&uuml;ssen die Erweiterung &quot;.php&quot; aufweisen und <b>nicht</b> ".html" bzw. ".htm"!</li>
</ul></font></td></tr></table><!--
*/
$webyep_sIncludePath = "./";
$iDepth = 0;
while (!file_exists($webyep_sIncludePath . "webyep-system")) {
	$iDepth++;
	if ($iDepth > 10) {
		error_log("webyep-system Ordner nicht gefunden.", 0);
		echo "<html><head><title>WebYep</title></head><body><b>WebYep:</b> Diese Seite kann leider nicht angezeigt werden <br>Problem: Der webyep-system Ordner konnte nicht gefunden werden!</body></html>";
		exit;
	}
	$webyep_sIncludePath = ($webyep_sIncludePath == "./") ? ("../"):("$webyep_sIncludePath../");
}
if (file_exists("${webyep_sIncludePath}webyep-system/programm")) $webyep_sIncludePath .= "webyep-system/programm";
else $webyep_sIncludePath .= "webyep-system/program";
include("$webyep_sIncludePath/webyep.php");
// -->?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=992, user-scalable=yes"/><title>Index</title>
<link rel="stylesheet" href="Index.css?version=7" type="text/css" />
</head>
<body>
<div id="div_174">
	<p id="textarea_181">
    	Veranstaltungsbeginn: <?php webyep_shortText("Beginn", false); // WebYepV1 ?><br><br>
	  <?php webyep_longText("Informationen", false, "", true); // WebYepV1 ?>
<br><br></p>
</div>
<div id="div_175">
  <?php webyep_image("Bild", false, '', '', '', 440, 0, false, 0, 0); // WebYepV1 ?>
</div>
<div id="div_176">
<div id="div_177">
		<p id="textheader_180">
		  <?php webyep_shortText("Untertitel", false); // WebYepV1 ?>
		</p>
	</div>
	<p id="textheader_179"> 
	  <?php webyep_shortText("Überschrift", false); // WebYepV1 ?>
	</p>
</div>
</body>
</html>

Die App:
Der ViewController.m:
Code:
[COLOR=#008400]//[/COLOR][COLOR=#008400]//  WebiPadViewController.m[/COLOR]
[COLOR=#008400]//  WebiPad[/COLOR]
[COLOR=#008400]//[/COLOR]
[COLOR=#008400]//  Created by Chakra on 14/04/10.[/COLOR]
[COLOR=#008400]//  Copyright Chakra Interactive Pvt Ltd 2010. All rights reserved.[/COLOR]
[COLOR=#008400]//[/COLOR]


[COLOR=#D12F1B][COLOR=#78492a]#import [/COLOR]"WebiPadViewController.h"[/COLOR]


[COLOR=#bb2ca2]@implementation[/COLOR] WebiPadViewController


[COLOR=#bb2ca2]@synthesize[/COLOR] webDisplayiPad;


[COLOR=#008400]/*[/COLOR]
[COLOR=#008400]// The designated initializer. Override to perform setup that is required before the view is loaded.[/COLOR]
[COLOR=#008400]- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {[/COLOR]
[COLOR=#008400]    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {[/COLOR]
[COLOR=#008400]        // Custom initialization[/COLOR]
[COLOR=#008400]    }[/COLOR]
[COLOR=#008400]    return self;[/COLOR]
[COLOR=#008400]}[/COLOR]
[COLOR=#008400]*/[/COLOR]


[COLOR=#008400]/*[/COLOR]
[COLOR=#008400]// Implement loadView to create a view hierarchy programmatically, without using a nib.[/COLOR]
[COLOR=#008400]- (void)loadView {[/COLOR]
[COLOR=#008400]}[/COLOR]
[COLOR=#008400]*/[/COLOR]






[COLOR=#008400]// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.[/COLOR]
- ([COLOR=#bb2ca2]void[/COLOR])viewDidLoad {
	
[COLOR=#D12F1B][COLOR=#000000]	[/COLOR][COLOR=#703daa]NSString[/COLOR][COLOR=#000000] *urlAddress = [/COLOR]@"http://192.168.178.56"[COLOR=#000000];[/COLOR][/COLOR]
	
[COLOR=#008400][COLOR=#000000]	[/COLOR]//Create a URL object.[/COLOR]
	[COLOR=#703daa]NSURL[/COLOR] *url = [[COLOR=#703daa]NSURL[/COLOR] [COLOR=#3d1d81]URLWithString[/COLOR]:urlAddress];
	
[COLOR=#008400][COLOR=#000000]	[/COLOR]//URL Requst Object[/COLOR]
	[COLOR=#703daa]NSURLRequest[/COLOR] *requestObj = [[COLOR=#703daa]NSURLRequest[/COLOR] [COLOR=#3d1d81]requestWithURL[/COLOR]:url];
	
[COLOR=#008400][COLOR=#000000]	[/COLOR]//Load the request in the UIWebView.[/COLOR]
	[[COLOR=#4f8187]webDisplayiPad[/COLOR] [COLOR=#3d1d81]loadRequest[/COLOR]:requestObj];
	
	
	
[COLOR=#3D1D81][COLOR=#000000]    [[/COLOR][COLOR=#bb2ca2]super[/COLOR][COLOR=#000000] [/COLOR]viewDidLoad[COLOR=#000000]];[/COLOR][/COLOR]
}






[COLOR=#008400]// Override to allow orientations other than the default portrait orientation.[/COLOR]
- ([COLOR=#bb2ca2]BOOL[/COLOR])shouldAutorotateToInterfaceOrientation:([COLOR=#703daa]UIInterfaceOrientation[/COLOR])interfaceOrientation {
[COLOR=#BB2CA2][COLOR=#000000]    [/COLOR]return[COLOR=#000000] [/COLOR]YES[COLOR=#000000];[/COLOR][/COLOR]
}


- ([COLOR=#bb2ca2]void[/COLOR])didReceiveMemoryWarning {
[COLOR=#008400][COLOR=#000000]	[/COLOR]// Releases the view if it doesn't have a superview.[/COLOR]
[COLOR=#3D1D81][COLOR=#000000]    [[/COLOR][COLOR=#bb2ca2]super[/COLOR][COLOR=#000000] [/COLOR]didReceiveMemoryWarning[COLOR=#000000]];[/COLOR][/COLOR]
	
[COLOR=#008400][COLOR=#000000]	[/COLOR]// Release any cached data, images, etc that aren't in use.[/COLOR]
}


- ([COLOR=#bb2ca2]void[/COLOR])viewDidUnload {
[COLOR=#008400][COLOR=#000000]	[/COLOR]// Release any retained subviews of the main view.[/COLOR]
[COLOR=#008400][COLOR=#000000]	[/COLOR]// e.g. self.myOutlet = nil;[/COLOR]
}




- ([COLOR=#bb2ca2]void[/COLOR])dealloc {
[COLOR=#4F8187][COLOR=#000000]	[[/COLOR]webDisplayiPad[COLOR=#000000] [/COLOR][COLOR=#3d1d81]release[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
    [[COLOR=#bb2ca2]super[/COLOR] [COLOR=#3d1d81]dealloc[/COLOR]];
}


[COLOR=#BB2CA2]@end[/COLOR]

Der ViewController.h:
Code:
[COLOR=#008400]//[/COLOR][COLOR=#008400]//  WebiPadViewController.h[/COLOR]
[COLOR=#008400]//  WebiPad[/COLOR]
[COLOR=#008400]//[/COLOR]
[COLOR=#008400]//  Created by Chakra on 14/04/10.[/COLOR]
[COLOR=#008400]//  Copyright Chakra Interactive Pvt Ltd 2010. All rights reserved.[/COLOR]
[COLOR=#008400]//[/COLOR]


[COLOR=#D12F1B][COLOR=#78492a]#import [/COLOR]<UIKit/UIKit.h>[/COLOR]


[COLOR=#bb2ca2]@interface[/COLOR] WebiPadViewController : [COLOR=#703daa]UIViewController[/COLOR] {


	[COLOR=#bb2ca2]IBOutlet[/COLOR] [COLOR=#703daa]UIWebView[/COLOR] *webDisplayiPad;
}


[COLOR=#BB2CA2]@property[COLOR=#000000]([/COLOR]nonatomic[COLOR=#000000],[/COLOR]retain[COLOR=#000000]) [/COLOR][COLOR=#703daa]UIWebView[/COLOR][COLOR=#000000] *webDisplayiPad;[/COLOR][/COLOR]




[COLOR=#BB2CA2]@end[/COLOR]

Beste Grüße,
Chris

iPad WebView Application reloadet nicht zuverlässig iPad oder PHP?
 
So, ich habe die Lösung.
Es lag am PHP Server, der da etwas Chaos verursacht hat.

Jetzt habe ich einen anderen Server rausgekramt und nun laufen 3 iPads seit etwa einer Stunde fehlerfrei!