How to know if QLPreviewController successfully loaded a document/failed to load it? - objective-c

My iOS app loads a variety of documents using QLPreviewController. My aim is to set a flag if the document loaded properly and show an error if it didn't.
Curiously the QLPreviewControllerDelegate protocol offers no callback to check this, nor does the QLPreviewController seem to throw any exception when I try to load an invalid file.
For the record, I tried loading an invalid PDF and it simply logged a message about not being able to find the header and displayed an empty file.
Can anyone please tell me how I can figure this out?
Thanks!

If establishing whether an item could be displayed beforehand works for you then a call to the following may be an option:
+(BOOL)canPreviewItem:(id<QLPreviewItem>) item

Related

can't save changes when deleting Routing App Coverage File

I'm trying to remove the Routing App Coverage .geojson file. Every-time I try to remove this and save changes, I get this error:
We’re temporarily unable to save your changes. Please try again
later.
It's been 2 days now. I still can't remove it. If I try to change any other field in the app submission form, it works. Just not the Routing file.
Here is what happened that led to this point:
I tried to submit an app with a valid .geojson file
I got an Invalid Binary error and the app was not submitted. This is because my app does not support routing.
I try to remove the Routing .geojson file from my submission form.
It doesn't work. I keep getting the error " We’re temporarily unable to save your changes. Please try again later. "
Error keeps occurring after 2 days.
I have no idea what is wrong. Please help. Thanks
I do not know if you have solved this, but I had the same problem. Just inspect the element (that pop-up that appears on top of the Routing App coverage), delete the element from browser's tree and press the delete button.

iTextSharp.text.Image.GetInstance changes Request.MapPath

I've been stuck on this problem all night. I've looked everywhere and can't seem to find anything related to my exact problem. On our IIS server we have a page that creates a pdf. We put an image in the header of the created PDF. This had been working properly until last night when we updated some unrelated code on different pages. Now when we try to create the PDF we get an error that the image file doesn't exist. Here's the weird part, iTextSharp.text.Image.GetInstance is changing the path we send to it?
Here's the line of code
Dim oImage As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Request.MapPath("~/images/" & sLogo))
If we output the results of Request.MapPath("~/images/" & sLogo) we receive
E:\Inetpub\sitename\images\logo.jpg
When we place it in in the iTextShart.text.Image.GetInstance() function our path output changes to
C:\Windows\SysWOW64\inetsrv\images\defaultlogo.jpg
You can see the logo itself changes too, it should be noted that we do use DefaultLogo.jpg in the case that a client doesn't use their own logo but all the ones i'm testing with do. The path E:\Inetpub\sitename\images does exist and logo.jpg does exist.
Here's the weirdest part, if i change the path from images to image
IE: iTextSharp.text.Image.GetInstance(Request.MapPath("~/image/" & sLogo))
the output will be
E:\Inetpub\sitename\image\logo.jpg
So i have no idea why images doesn't resolve.
Any help is greatly appreciated, and if this answer has been posted before and i just can't find it i'm very sorry, and if you could point me to that i would appreciate that as well.
I figured out my issue, and it's sheer stupidity on my part. The page we call to create the pdf had bad security on it. Basically we were looking for a session variable that didn't exist and redirected that page to a session time out notice. Removed that session check and it's working now!

Getting a handle to dojo's uploader filelist

We are using dojo's dojox.form.uploader.FileList in our application to show the progress of file upload. But it shows the name of the file, type extension by default. We could not see any settings to hide it or getting a handle to that. Is it possible to get a handle to that object which has file name, size and extension? Could you please help us?

MediaElement Uncaught TypeError: Cannot read property 'tagName' of null

I would like to use MediaElement to serve all the videos/formats we have without creating different players. My first attempt was with an .mwv file with throws the error listed in the Title of this post. Next I tried an MP4 which seems to work fine. Then I tried an .flv file which also threw the same error listed in the title.
In Chrome I see "Uncaught TypeError: Cannot read property 'tagName' of null" the console which occurs in mediaelement-and-player.min.js at line 40 but the viewer part of the player doesn't display at all. In Firefox I see "TypeError: d is null" in the console at the same line number but the viewer part of the player DOES display and it says: "Video format or MIME type is not supported". The MediaElement documentation indicates that those types are supported but I can't seem to get them to play.
Either I mis-configured the player or I am passing the wrong content-type (I tried several) or this is a bug. I saw a similar post but the solution posted there was a little vague. I am going to try different files, formats and mime types to see if I can sort out the issue but I think this is a code problem. Ha anyone else been able to play flv or wmv files with mediaElement? Was there a trick to making it work?
I missed a step (or a directive) in the configuration. The 'tagName' error had to do with the content type I was using and was not defined in Glassfish. The reason that nothing was playing was that I forgot to list the class as "mejs-player" in the video tag.
Cleaning up those two things got the player working.

Saving a user edited text field to a .js file in iOS

I'm creating an iOS5 app (programmed in Objective-C) which provides a couple of functions. One of them is to allow a user to fill out a text field with JavaScript. When the user presses a "Test" button, I want it to save to a specific JS file and move to a new view, displaying an HTML page that will display the results of that JavaScript on a canvas element.
Unfortunately for me, I have no idea how to save to a JS file for a text field. Nor do I know if this is actually the best way to achieve the results I'm after.
So can anyone tell me the code I'd need to place in the IBAction of my test button to save the file, or if there is a better way to get the user's script into the HTML file with the canvas element?
You have some options to do that.
Add a callback in WebView is possible only in desktop apps, but you can make a workaround.
1- Set a handler to click in javascript;
2- This handler parse the value via windows.location (trying to change the current url);
3- In UIWebviewDelegate set webView:shouldStartLoadWithRequest:navigationType: to recognize this values parsed by javascript and returning NO (canceling the url change).
After you have the code typed by user, is easier pass to the new one UIWebView. You can save the file via NSData or other class and load in by the path, or you can parse directly the code to be showed via NSString.
EDIT
I, still, belive what I said is what you want, but with a little more info. Yes, 3 NSString probably solve your problem. You even can call eval in javascript, via objective-c and parse user code too. Those logic ideas are a good approaching. You can choose the easier for you.
There are more info in this another Q&A
You can use html 5 local storage for that.