NSUserDefaults and adding UIImages to an application via the web - objective-c

I have an app that uses chat stickers. I would like to add more stickers to the app over time without having to make the user download an update. I understand that I can store data in NSUserDefaults so was wondering if it's possible to get an app to download images from a server to the NSDefaults? Say via parse or a similar service? Is this kind of thing allowed in an app? I read something in the developer guidelines that placeholders could not be used. Any advice on this would be really appreciated. Thanks!

If you want to use parse the store all the images in a table in the parse file storage. Download the images using the Parse SDK. The downloaded images will be cached appropriately by the SDK so you won't need to handle the cache yourself.
You can read more about how to store files with Parse here: https://www.parse.com/docs/ios_guide#files/iOS

NSUserdefaults is not meant to store big files like images. It should only contain small amounts of data.
You will need to download the images and save them locally. To download the image to a file use NSURLDownload.

Related

Upload Image To Cloudinary Using Java API

I am using cloudinary API with JAVA. We have a requirement to upload images with an auto increasing number automatically. Like 1.jpg, 2.jpg, 3.jpg...
When I upload the first image(abc.jpg) so it would become 1.jpg.
When I upload the second image(xyz.jpg) so it would become 2.jpg. Same for others.
does cloudinary provide any kind of solution for this situation?
This is not supported, this is something that you need to manage by yourself.
Maybe you can rename any uploaded image after receiving the notification URL on your server, but you need to keep in mind stuff like async actions...
Best,
Yakir

How to store images for mobile development

I decided to use back4app for easily creating my backend and for having a built in hosting solution.
I'm quite a newbie with this tool so my question will seem "simple":
I was wondering how will I store the images of my mobile application. As far as I know they use AWS so I thought the service would provide like an interface to upload some images to a S3 bucket...
Should I create a personal bucket or does the service offer that kind of feature ?
The idea is to store then the absolute url of the image in my model. For example each Class has a cover field of type string.
you're right, Back4App use AWS.
Back4App prepared the Backend for you, for example, if you try to save a file direct at your Parse Dashboard, you will can access the image and you already have a absolute URL.You can configure the column with a type File, like below:
Add a column with the File type
After upload a file, you will can access click at the box :)
After that upload the file

Saving data on phone in a Cordova app

I am making a mobile app using Cordova and I need to save some sensitive and not so sensitive data inside the phone. I am a bit lost on what is the best way to do it.
I need to save:
A JSON web-token (for authentication).
A response from server (I save this to populate my page in case the GET request fails).
Coordinates information when user is logging data to the app (for later upload to a server from with in the app). These will be many separate logs, and can be large in size for local storage ~5-10 MB.
Till now i have been successfully saving everything I need to the local storage but I don't think that is the correct way to do it. So that is why I need some help in deciding what is the best course to take from security point of view.
Saving server response is just for better UI experience and static in size so I guess local storage is a good option to use.
But web-tokens and GPS logs is sensitive information and I dont want to keep it in the local storage as it is accessible from outside the app.
What other options do I have?
Cordova still doesn't have encrypted storage.
Is saving to files a good approach? This here says that data contained inside cordova.file.applicationStorageDirectory is private to the app.So can I use it to save the logs and the token?
The plugin also lists the file systems for Android and iOS and lists which of those are private.
I am currently working with android phones but want to extend the app to iOS later. I have never worked with file systems and caches before so I am a bit lost.

Titanium: Best place for storing secret files

Since i cant play an audio file from a DB blob, i have to write it as a file, before i can play it.
Looking at the documentation, my choices are:
Ti.Filesystem.applicationDataDirectory
Ti.Filesystem.tempDirectory
Ti.Filesystem.externalStorageDirectory
Ti.Filesystem.applicationCacheDirectory
Considering that i want my file to be secret, so no other app can see that file, what is my best option?
EDIT: So the issue is more with Android, i'm afraid that any file browser will be able to find the file.
I'm assuming you're building for android, because ios data are sandboxed and not readily accessible by default (until ios8). Rather than hiding them, just encode them using base64encode(). And then you can decode when accessing the file with base64decode().
With that said, I've never had to use it. So, I don't have an example. But you can read about it in the api doc.
Hope that helps.
You haven't mentioned if you are building an app for iOS or Android. For example Ti.Filesystem.externalStorageDirectory is available only for Android (SD card).
Anyway if you want to save an audio file, you should save it in <Application_Home>/Documents ,so you should use Ti.Filesystem.applicationDataDirectory. Don't forgot to set up a remoteBackup flag see http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Filesystem.File-property-remoteBackup
Also have a look at iOS Data Storage Guidelines for more details
https://developer.apple.com/icloud/documentation/data-storage/index.html
*If you want to save an audio file only because you need to play it ,but you don't need to store it in a fileSystem then is better to use Ti.Filesystem.tempDirectory

Upload large file on server is this possible by create firefox addon

I want to upload large video file. for that i want to create firefox addon. Is this possible by create firefox addons to upload large files on my server.
or is there any other way to upload large files on server.
please suggest.
If you are POSTing the data to the server as application/x-www-form-urlencoded then you should base64 encode it using btoa() and include it as one of the POST parameters in the request body (i.e. the string passed to XMLHttpRequest.send()):
postbody = "body=" + btoa(fileContents);
xhr.send(postbody);
If you are just downloading the file and uploading it right away, you might as well keep it in memory since you're presumably going to load it into memory anyway in order to base64 encode the contents.
Well if you're reading the file into memory then you should need an nsIFile at all. You can just download it using XMLHttpRequest and use responseText, uploading it in the way I described in the answer. If you do have an nsIFile then yes, that snippet describes how to read from it.
I assume you are wanting to upload via HTTP.
If so, the upload limit is usually decided by the server-side software. This affects both the maximum size and the length of time you have to upload it.
Without a server capable of taking an upload in chunks and reassembling it, you are limited in ways you can't get around through software.
If you want to upload via FTP on the other hand, there are a lot of options... look at FireFTP.
I have made firefox addons for fileupload.
I integrate jquery file upload.
I create widget. In the widget I made panel. In panel I create separate web page for file uploading. And panel is calling that page.
For more information you can mail me at chetansinghal1988#gmail.com