UIWebView html file with swf load external link, b

2019-08-05 07:33发布

问题:

When I load an external HTML with SWF embedded, it work in UIWebView.
When I try to add all files in Xcode, and load the UIWebView local, nothing appears, but I know it tried to load ...
-The Code:

NSString *filePath =
[[NSBundle mainBundle] pathForResource:@"vimmar" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:filePath];

if (htmlData)
{
    NSBundle *bundle = [NSBundle mainBundle];
    NSString *path = [bundle bundlePath];
    NSString *fullPath = [NSBundle pathForResource:@"vimmar"
                                            ofType:@"html" inDirectory:path];
    [pagina_web_local loadRequest:[NSURLRequest requestWithURL:
                          [NSURL fileURLWithPath:fullPath]]];
}
else
{
    NSLog(@"No data for you...");
}

-And here HTML

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
  <title>Default</title>
  <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  <meta name="apple-mobile-web-app-capable" content="yes"/>
  <style type="text/css">
    @media only screen and (min-device-width: 800px) { html { overflow:hidden; } }
    * { padding: 0; margin: 0; }
    html { height: 100%; }
    body { height: 100%; overflow:hidden; }
    #container { height: 100%; min-height: 100%; width: 100%; margin: 0 auto; }
  </style>
  </head>
  <body>
  <script src="swfobject/swfkrpano.js"></script>
  <div id="container">
    <div id="panoDIV" style="height:100%;">
    <script>
      embedpano({target:"panoDIV",swf:"vimmar.swf"});
    </script>
      <noscript>
        <div id="tour">
          <object width="100%" height="100%">
            <embed src="vimmar.swf" width="100%" height="100%" allowFullScreen="true"></embed>
          </object>
        </div>
      </noscript>
    </div>
  </div>
 </body>
 </html>

Do not know if it has to do with the fact that the apple does not accept SWF. But if not, why are carried outside? Do you agree?

Not for lack of adding the files. JS or other, as I found here a staff with trouble loading. JS was read and useful, but have not found SWF.

Thank you.

回答1:

I suspect that Apple would not build the JavaScript and process the embedded SWF file in HTML.

So I looked for a way to create a webservice in iOS to compile and run SWF needed here (https://github.com/robbiehanson/CocoaHTTPServer/).
SWF file is not pure, it compiles and transforms into a format acceptable to HTML. Thing that XCode does not natively. So, I got the result we needed.

If you someone need, this is the solution, creating a mini webservice to compile javascripts and other things that a server is to process and display the final result in HTML.



回答2:

I am having trouble understanding your question - but Flash will not work in a UIWebView. If you browse a specific website in Safari, and it seems like it is working, that website is probably serving up a HTML5 version instead.



回答3:

iOs strictly don't support any flash items which includes swf also.

reasons: 1)flash drains battery that is to run that swf has to be decoded the decoding should be on hardware level not on software level unofrtunately 5o % percentage of flash items(not latest) causes to use software level decoding

2)causes security vulnerability even mcaFee also claims the above one as critical

3)app crash: flash is the number one reason for app crash in mac

4)Ease of development: Mac doesn't want their developers concentration to be diverted on third party items and third party won't customize for particular platform it will be cross platform eventually.

5)Finacial reasons: Allowing flash on ios will compete with app store..

so for above reasons ios don support flash

if u want flash for any charts u can go through the follwing links

http://blog.fusioncharts.com/2012/02/create-charts-for-iphone-and-ipad-apps-using-fusioncharts-xt/ http://docs.fusioncharts.com/charts/contents/FirstChart/UsingPureJS.html http://docs.fusioncharts.com/charts/contents/index.html?FirstChart/UsingPureJS.html