Get Info about several files in 1 request - ios

I have a bunch of files downloaded for offline viewing from Box together with their IDs/modifiedAt.
I want to check them all for updated modifiedAt.
I am currently using files/FILE_ID (http://developers.box.com/docs/#files-get), but then I need to send a request for each file.
Is there any way to get file info in bulk, many files at once?
(I am using the iOS SDK)
Thank you

The API currently does not support bulk operations, unfortunately, though it's something we're considering.

Related

Android 11 Storage Access Framework - How to use files?

Hey there fellow devs,
I have come across a problem while migrating our app to the new API 30 standards with the storage access framework (SAF).
I have successfully migrated the file structure and am now using the internal (FilesDir) paths.
Getting images with the MediaStore-Api is also working quite nicely.
But there is one big issue I just can't seem to fix.
In our app, we are using the API "Mapsforge" for Offline-Maps.
This API is using a Java.IO.File-Object we get from a path to a ".map" file which is almost 2GB large.
This file does not come from us, it is a file managed by the customer and put onto the device for us to use, since all the ".Map"-Files are custom.
Since the SAF is returning an Android.Net.Uri, I can't seem to convert it to a Java.IO.File without copying the contents of the file and therefore using even more storage on the device.
Is there any way to use the SAF to get a Java.IO.File-Object I can use in code?
If not, then Android 11 is making it very hard for my Customer to manage his storage.
This API is using a Java.IO.File-Object we get from a path to a ".map" file which is almost 2GB large.
With luck, Mapsforge will offer more flexible APIs in the future. You may wish to contact them about their recommendations.
Is there any way to use the SAF to get a Java.IO.File-Object I can use in code?
No. After all, the user might choose something on Google Drive or another cloud storage provider, rather than a local file. Or, they might choose a file that is inaccessible to your app. Or, they might choose content that is stored in an encrypted file, which needs to be decrypted by the document provider. And so on.

Uploading pdf files stored in iphone to server in ios

I am making an iphone application which is pretty much like forum. People can ask question and upload a pdf/doc file along with the question. Is there a way to access the pdf/doc file in iphone when user clicks upload button and send the file to server?
I have implemented the feature for image for which I used UIImagePicker to pick the image and send it to the server with http request. But I am completely lost and have no idea how to handle pdf/doc files in same manner.
Any help/suggestion really appreciated. Thanks in advance.
If you want to upload PDF and Doc files, then you can integrate Dropbox and Google Drive in your app and then select the files ,as Apple does not have centralised storage. If you notice Apple also chooses the documents from Google Drive while composing a mail.
So implementing and integrating google drive and Dropbox would be a good option.
Here is the link for Dropbox https://www.dropbox.com/developers-v1/core/sdks/ios
Here is the link for Google Drive https://developers.google.com/drive/ios/quickstart
Implementing Google drive is a bit hard but dropbox is quite simple.
Wish it saves your time. All the best!
I think you are looking for a combination of two things (both have been discussed here before and I include the links below).
(1) store a PDF. There are many options but the best way is to allow coredata to save outside the persistent store. Then store the reference to the file in core date. See: Insert a PDF file into Core Data?
(2) send the file to the server. There are many options for this as well. The fastest is probably to use a wrapper library such as ASIHTTPRequest. See: File Upload to HTTP server in iphone programming

Google Drive as a video hosting/streaming platform?

I'm developing an iOS app that generate video files and have a social gallery for users to display their clips. After a lot of research I found that Google Drive would be perfect to fit my needs so I did some testing and sucessfully made the app upload the file to GDrive and everything.
Now I need to stream the uploaded file in a MPMoviePlayerViewController, for that I would need some kind of direct link, I'm right? After my initial tests I used the variable WebContentLink as a source URL and it worked flawlessly, I was really happy with the result, however now it doesn't work anymore, I don't know what happened and I think the method that I used is not realiable? I tried all the other possible links and none of them seems to work.
Can someone give a guidance about if this is really supported by Google Drive and how it's the best way to archive that in a reliable way?
Thank you very much !
I too encounter the same error when I try to download 28 times (testing) the same 24mb file.
However I realise if I am to download using the content owner ID, it does allow downloading after the 28th time
https://docs.google.com/a/onwardsct.com/uc?id=0ByvXJAlpPqQPYWNqY0V3MGs0Ujg&export=download
Sorry, you can't view or download this file at this time.
Too many users have viewed or downloaded this file recently. Please try accessing the file again later. If the file you are trying to access is particularly large or is shared with many people, it may take up to 24 hours to be able to view or download the file. If you still can't access a file after 24 hours, contact your domain administrator.
The experience for streaming files natively is not ideal right now, sorry. It is something Google are working on.
You are doing this correctly though. The webContentLink should use the user's quota, and that should be enough for most cases. If you can give some specific numbers, we can look at it.
The embed link is the best way to show it on a mobile device, but as you say won't work everywhere.
yes, google drive can be used for hosting and stream videos as you like. It can also be used as demo server for web projects. Here is how to host a website on Google drive.

HTML contents preloaded into an app and then updated from the Internet

The title says (quite) all: I would like to distribute an app with some HTML pages preloaded into the local Documents folder (they reflect the content of a mini mobile site available on the internet); then, when the contents of the pages are updated, the local HTML files into the app should be updated, so that the user can browse the updated informations also when not connected to the internet.
The app has to work since the first start, thanks to the preloaded pages, and then update itself periodically (I didn't need to check the modify date/time of the single files, it's enough to check and update them when the local copies are older than x days).
The problem: I think I can do it all, but I was asking to myself if is there some framework/class that does it automatically, because it sounds to be a pain :)
Consider using ASIHTTPRequest. Check out this SO question.
Specifically, you might want to look into ASIWebPageRequest:
download complete webpages, including external resources like images
and stylesheets. Pages of any size can be indefinitely cached, and
displayed in a UIWebview / WebView even when you have no network
connection.
I've also used AFNetworking for my own personal projects and it's made my life 10x easier. On the AFNetworking FAQ page, there's a question regarding caching mechanisms for offline viewing. It mentions that NSURLCache in iOS 5 introduced support for caching to disk for offline use - but only for http. If you need to cache https, consider using SDURLCache.
Here's a short additional resource in regards to network caching for iOS.
Read the section titled iOS network caching
If you are looking at pre popping your iOS app with the equivalent of a browser cache then
https://github.com/rs/SDURLCache might be something to look into.
It hooks in with existing NSURLConnection frameworks such as AFNetworking and you just need to set the correct cache policy in your NSURLRequest.
Given its open source you should be able to figure out how where to place your data so it loads it without fetching from the server the first time then just specify when you want the cache to purge itself so it fetches it from the server?

iPad app designing: sync with Excel file

I'm designing a new app for iPad for a small company. This app will use Core Data to store a local database and a database of products and prices. The last database needs to be always up to date since the prices can change.
This company, has a Excel file to keep this database of prices. So they don't have a SQL db to which I can interact from my app.
One option could be to export the Excel file in CVS and put that file in their server (accessible by internet). Then my app should parse the file.
I don't like very much this idea, though.
Do you have any suggestion?
I had a very similar problem to you. I recently got into a project where the client wanted to import information from an Excel file into an app. I know a lot of people say, just transform it into a CSV and parse it that way, but I really didn't want the client to go through yet another step and introduce a different file format - as simple as that may be.
I also really don't like having the information in the cloud, especially Google. Privacy is something that's important to most companies and I'd doubt they'd approve of you using Google to parse the info.
In order to parse the file, I created QZXLSReader. It's a drag-and-drop solution so it's a lot easier to use. I don't think it's as feature complete, but it worked for me.
It's basically a library that can open XLS files and parse them into Obj-C classes. Once you have the classes, it's very easy to send them to Core Data or a dictionary or what have you.
I hope it helps!
Here are a couple of options for you:
Use Google Doc as the intermediary. When the pricing Excel is updated by someone, simply upload the updated Excel to Google Docs. From your iPad app, you can read the latest data via the Goole API. If the company is up for it, they can move to Google Doc altogether and just modify the online Google Spreadsheet directly.
Use services like StackMob as the intermediary. You will have to write a tool to sync the pricing Excel with SrackMob but you can easily access the data via StackMob's iOS SDK.

Resources