Creating dynamic manifest files that work with ipads and iphones - iphone

Problem: The browsers within apples ipad and iphone don't seem to like dynamically generated manifest files (we constantly get errors involving either missing images or .aspx pages that can be accessed from the device or "Application Cache manifest could not be fetched"). We originally had a manifest.ashx acting as our manifest that would dynamically create and pull some pieces from the web server for offline app functionality. This process worked fine for the majority of browsers and mobile devices but failed on the apple products.
Thoughts: For some reason safari doesn't seem to register the manifest.ashx correctly (this is where we dynamically create the manifest file) and just gives up on trying to open it. We truly need a dynamic manifest file for the requirements of the project so switching to a static manifest file would not work. Does anyone have any suggestions towards alternative creation methods for dynamic manifest files?
Code:
manifest.ashx
public class Manifest : IHttpHandler
{
public void ProcessRequest( HttpContext context )
{
ManifestGenerator generator = new ManifestGenerator();
context.Response.ContentType = "text/cache-manifest";
//Create the dynamic manifest file here (returns the manifest as a string)
context.Response.Write( generator.GenerateManifest() );
context.Response.Flush();
}
}
Thanks,
Updated Thoughts v1: Leaning towards thinking this maybe a device specific manifest fault as all the other mobile and desktop devices are accessing the app just fine (including being able to go offline). Currently I have moved back to a dynamically generated manifest (within the manifest.ashx) and the ipad / iphone still dies when trying to fetch but it does get further then it did before (error was: "Application Cache update failed, because "file path goes here" could not be fetched"). A strange aside to this is the fact that the desktop version of safari handles the web app just fine (as well as an install of chrome on the ipad had no troubles accessing the site on/off line) while the mobile versions of it do not.
Updated Thoughts v2: Seems that this issue is safari specific as I have the web app running online/offline with chrome for the apple products (iphone/ipad). Still looking for a fix / work around for the safari browsers though...

For Safari/iPad, the manifest file must end with .manifest. Atleast, that's what my tests determined.
So, in order to make this work, you will have to dynamically generate the .manifest file using a HttpHandler and some changes in web.config to do map cache.maifest to the handler. The idea is that the call to the non-existent cache.manifest would actually get mapped to the handler, which would then send back dynamic content.
This is currently the part I'm stuck at, so I cannot help you here yet.

Related

Receive share file intents with Flutter with IOS

I'm using the following plugin
https://pub.dev/packages/receive_sharing_intent
It is working with android.
But the instruction for IOS are unclear - I follow the IOS instruction and I'm able to share files with my app, when I do so, my app opens but the flutter code is not executed, the only thing I see in the log is:
6.26.0 - [Firebase/Analytics][I-ACS023000] Deep Link Web URL query is empty
Which doesn't mean any thing to me.
I tried to look for this error and couldn't find anything that is related to sharing intent.
Can someone clarify this?
Is there a tutorial on how to set sharing intent for IOS?
In the instruction it says:
ios/Runner/Runner.entitlements
....
<!--TODO: Add this tag, if you want support opening urls into your app-->
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:example.com</string>
</array>
But I don't have such file in my directory structure, any idea how to set it correctly?
....
EDIT:
I created and added the file ios/Runner/Runner.entitlements manually
I noticed I missed the last step (after publishing the question), so I did it:
Add Runner and Share Extension in the same group
Go to the Capabilities tab and switch on the App Groups switch for both targets. Add a new group and name it group.YOUR_HOST_APP_BUNDLE_IDENTIFIER in my case group.com.kasem.sharing
This step is not very clear:
the name of the tab is Signing & Capabilities
in order to switch on the App Group you should click on `+ Capability' in the top left of the tab
I checked the checkbox next to App Group
Add a new group and name it group.YOUR_HOST_APP_BUNDLE_IDENTIFIER in my case group.com.kasem.sharing
After this I was able to receive the file intent in the App but couldn't open the file:
print("$path, exist ${await io.File(path).exists()}");
I was able to print the path but the exists method return false
NOTE:
works with no issues in android
works with no issues in IOS when sharing an image
only fails with files (PDF)

merge large existing web app into Sailjs site

I'm trying to merge large existing web app into sails.js. so I moved the folders into assets and build a custom route , 'GET /': '/assets/client/launch.html' and get 404 when I point my browser to http://localhost:1337/ as the / is correctly redirected to http://localhost:1337/assets/client/launch.html which produces the 404.
Now the file exists in the folder assets/client (and in .tmp), so I am thinking the Sails router is getting in the way.
I would leave the client (70K lines of JS) that generates all the UI dynamically and sailjs server that provides authentication separate and enable CORS but my customer wants client packaged with server. This type of operation is simple in frameworks like ASP.NET MVC but am wondering if Sails is up to the task.
Well, If everything you tried did not work out. There might be another solution ,
First of all since you are talking about sails app I am assuming other bundle must be sails as well ,
So here is what you do-
Change the port for another app that you want to attach to this.
Second whenever you want to go to page on another app simply redirect the client to another port ie
in html or esp put a href tag with different port.
<a href="localhost:PORT/route_to_file">
</a>
I got it working by placing my app into assets where we need to launch from assets/client/index.html as there would be too many dependencies to change. As I said above could not just add a route as Sails must getting in the way. However as in Chapter 3.2.2 of Sails in Action I generated a static asset npm install sails-generate-static --save. then I redirected to assets/client/index.html. As an aside that book is great and would highly recommend it.

Correct way to submit a phonegap/jQM form.

very new at this. Could someone tell me what is the best method of submitting a form when using phonegap and JMQ? What I want to be able to do is passing the form data to a php file and then having the results passed back into app so that the user isnt directly accessing the php file at any point.
I found the following page link which basically does what I want but I keep getting "Origin null is not allowed by Access-Control-Allow-Origin" when testing out the code. So I'm guessing this will only work if the app is located on a server also?
Any happy would be great. thank <3
To test your solution on the computer you need to launch chrome from the terminal with the argument --disable-web-security. See this answer: Disable same origin policy in Chrome
In your Phonegap application you add a line of code to your config.xml in the www-folder: <access origin="*.yourdomain.com" />. Build, and you are now allowed to request all domains and subdomains from yourdomain.com. For more details on whitelisting see http://docs.phonegap.com/en/3.0.0/guide_appdev_whitelist_index.md.html#Domain%20Whitelist%20Guide
You are not able to make post through the local files, so Yes, you need to have it running in a Web Server.
But if you deploy your application, it should work either in a emulator or in your device.

Single Sign On not working on TV

I've created a basic application (virtually no content, just a blank page) to test the SSO functionality. It doesn't work, when I test on the TV it gives the error error_cp_001.
The config.xml contains, among other things:
<cpauthjs>Authorization8888.js</cpauthjs>
<login>y</login>
The Authorization8888.js file contains:
var Authorization8888 = {};
Authorization8888.checkAccount = function(id, pw, cb) {
cb("TRUE");
};
I have already tried with <cpauthjs>Authorization8888</cpauthjs>. I have also tried with Authorization without 8888 for the filename and vars. It always shows that error.
I also tried in the SDK simulator, same error as on the real TV. On the simulator I see these extra debug lines:
[JS ALERT]: ####################22222eval(accountCheckFunc) error
[JS ALERT]: Fail to load Account check moudule.
Error : Can't find variable: Authorization8888
I can share the zip file containing the whole application, but it's really simple to reproduce since it has nothing except this basic SSO-related code.
I found the answer, posting it in case someone else hits the same problem.
The problem was deploying via USB. Apparently, an application deployed with the USB stick has limited functionality. Deploying the application via a web server fixed a lot of issues, including this one.

Create an App within an App

I am being presented with a very interesting project. The task that I must complete is to figure out a way to allow a partner to be involved in an app without giving up their source code. The code will be included in the main bundle of the app so it is not dynamically stored. The partner has a fully functional app that is needed to be ran in a window within the main app at the appropriate time. I know having the partners create a web app would be ideal so it is treated like a webpage but I am more concerned with codes that must be written natively in iOS.
My question is what is the best way to go about solving this? In theory it is like an App within an App. Is there a way if they gave up their .app file I can include this in the bundle and then run it when I catch a certain event? Should I have the partners create their code in a framework and then import into the shell project? What is the best way to approach this problem?
If your 2nd-party doesn't want to provide you with the source code, why doesn't he compile it to object code then let you simply link it to your app?
By the way, at least on official (non-jailbroken) iDevices, apps can't 'embed' or 'open' one another in such a way - you can open an app programmatically if 1. it's a separate app 2. it has a registered special URL associated to its bundle.
Is there a way if they gave up their .app file I can include this in
the bundle and then run it when I catch a certain event?
No, you'll want to have them create a library instead. You can then include that library in your project.
Creating a library is as simple as:
Choose File->New...->Project... in Xcode.
Select the "Cocoa Touch Static Library" project template.
Add your code.
Build.
The result is a static library that you can add to your application(s). The library will contain the compiled code that you added, but doesn't include the source code. The library developer should provide whatever header files are necessary to use the code in the library.
An App within an App is possible however it requires a common data framework that allows one app to reference the same data without confusing the the source of and destination of the data.
Such a framework allows one app to interact with another app referencing the same data.