I am designing an App for iOS using Swift 2.0, Basically my user uploads some photos to a gallery and tag the photos later. This is not a Social App, therefore only the user himself can see these photos. When the user uploads the photos, I want to store them locally somewhere because:
First, When the user opens the app again at a later time, and decides to browse through and tags stuff, he doesn't have to download them again.
Second, When he logs into another iOS device, the app should download the photos locally to the new device too and use them as cached.
So the solution should allow local caching of images, at the same time since the user may upload tons of photos, I should be selective about how many to cache locally, for instance, I think I need to have something like cache expiry in HTML, so if I hit "Let's say 50MB of local photos on device" I should wipe off the old ones until the limit goes back to 50MB.
I would like to get some expert advice on how to this.
I have created a library using swift 2 to do the request for image and cache it. it's very simple just give it a try.
https://github.com/georgehadly/GHImageCaching
all you can do is something like this ,
viewImg.getCachedImage("geo", URI: NSURL(string: "https://s-media-cache-ak0.pinimg.com/236x/8e/5a/98/8e5a98795dc2c5322cac97343a6cad6d.jpg")!) { (done) -> Void in
if(done){
// your extra
}
}
in case you want to delete all cached images
UIImageView.deleteAllCaching()
Related
I have website (https://www.kriscent.com/product/kart-supermarket/). I created PWA of that after that I uploaded it on Play store by using TWA(Trusted Web Activities), App URL is https://play.google.com/store/apps/details?id=in.kriscent.kartlite.
The URL of website always show in app, So I uploaded the assetlink.json (URL: https://www.kriscent.com/.well-known/assetlinks.json).
After uploading the assetlinks.json, When I run my app, the website URL disappeared but when I switched on other link in the app then the URL shows again.
I don,t know what is happening. Please help me if anybody has idea to resolve this issue.
enter image description here
enter image description here
The problem is that, when navigating to a product detail page, you are using a different origin than the one used to open the Trusted Web Activity and that doesn't have Digital Asset Links setup:
When the application is started, it opens https://www.kriscent.com/, which is correctly validated.
When clicking on a product, the user is take to https://kriscent.com/ (without www), which is a different origin, and is not validated in the Android app.
It is possible to get the Trusted Web Activity to work with multiple origins but, in this case, I'd recommend using a single origin for the initial URL and the navigations, as you will be able to take advantage of using the same service worker, browser storage, etc.
I have an app where I display network images. I cache the images.
I also cache the profile picture of the user his/her friends. But there is a possibility a user updates his profile picture.
I'm thinking of a system that removes the profile pictures of the friends every 2 days.
All the profile pictures have this url:
https://firebasestorage.googleapis.com/v0/b/myPROJECT.appspot.com/o/profilepicturesFolder%USERID
I'm using the package flutter cache manager.
Is there a possibility to delete all cached images this url:
https://firebasestorage.googleapis.com/v0/b/myPROJECT.appspot.com/o/profilepicturesFolder
I'm currently using this:
await DefaultCacheManager().emptyCache();
(but it removes all images of the whole app out of the cache)
Thanks in advance!
I suppose you are using this library: https://github.com/Baseflow/flutter_cache_manager
You can provide expiration time for each image(in your case 48 hours). After that, file will be removed and trigger update from your back end.
Also seems your library chose not supported to set expiration time easyly,
check https://github.com/Baseflow/flutter_cache_manager/pull/107
You need to provide special header for your images to ensure that cache will work only for 2 days
I'm attempting to set up an app for a small set of known users, all of whom have a sub "page", "account" or whatever the terminology du jour is. The main goal of the app is to publish photos to these sub-accounts in an automated fashion on their behalf.
The crux of the issue seems to be that while I can ask for "manage_pages" to manage the user's sub-accounts and for "publish_stream" which allows me to upload photos to the user's root stream I can't upload photos to a subaccount stream.
I've been able to do a status update on the sub-account stream (text only), but every time I try to upload a photo (via curl, commandline-style), I get various errors depending on how I try to do it:
http://graph.facebook.com/albumid/photos -> Error #324 requires upload file
http://graph.facebook.com/albumid -> Error #200 application does not have the capability to make this API call.
http://graph.facebook.com/subaccount_id/feed - > Error #100 Source URL is not properly formatted
http://graph.facebook.com/subaccount_id/photos -> Error #324 requires upload file
I've stabbed around in the dark like this for about 4 hours with no luck and am beginning to wonder: Is posting a photo to a user's sub-account stream even possible? If so, how?
(BTW, I have tried doing a text status update with a photo URL -- attempting to circumvent the whole uploading part -- and that doesn't help. The url of the photo appears in the post, but does not show the photo. I'm open to any suggestion that shows photos in a subaccount stream.)
Only about 5 minutes after posting this, I kind of, sort of found a solution:
First, upload the image to your own web server, s3 bucket, or other location.
Second, use http://graph.facebook.com/subaccount_id/feed with source=http://www.thenewlocationofyourimage.com/image.jpg.
The image shows up in the page stream, albeit as a small thumbnail. Better than nothing, though. If you have better information, PLEASE let me know. Thanks!
I found a similar problem in ' Let Users Submit To Our Flickr Feed (iPhone) '.
So, I want other people (using my iOS app) be able to upload photos to MY photostream.
I got it working with phpFlickr, using the setToken method and not using the auth method. (See bottom section how).
But I don't want to use this script and directly upload it to flickr, to cut out 'the middleman' (= my webserver), to limit data usage and server load etc.
I'm using the ObjectiveFlickr library for communication with flickr. Anyone who can give me a direction to work in or maybe a small piece of working code.
I'm having issues loading MY profile picture from a Flash App ON Facebook. It works fine locally, but when I upload to Facebook it loads this profile picture for ME ONLY (not my friends): http://profile.ak.fbcdn.net/
Here's what I'm doing:
Get the Facebook ID of my friends and me
Create a URL string: graph.facebook.com/[FACEBOOK ID]/picture?type=large for each of my friends and me.
Throw the URLs into loaders and load!
Facebook returns the actual address to each image: ie: http://profile.ak.fbcdn.net/hprofile-ak-snc4/370825_524761447_653077984_n.jpg
Throw the RETURNED address into another loader and then load the final, actual image.
Once this is done, the images are all loaded for all my friends, but for some reason, MY profile image always loads the generic one up at the beginning of the post (the profile.ak.fbcdn.net address without anything following...). It's this way for ANY user that's logged in. I've tested it on several profiles and had my friends test the app as well, they ALL get that generic picture as "their" picture ...
On a side note: The code worked fine before Christmas break in 2011 ... and when we came back to school in 2012 it didn't work any more, and we didn't change any of our code. I wonder if this is a Facebook API bug and not something we did.
Try this (put it somewhere when your app launches):
Security.loadPolicyFile("http://graph.facebook.com/crossdomain.xml");
Security.loadPolicyFile("http://profile.ak.fbcdn.net/crossdomain.xml");
Security.loadPolicyFile("https://graph.facebook.com/crossdomain.xml");
Security.loadPolicyFile("https://profile.ak.fbcdn.net/crossdomain.xml");
Security.allowDomain("*");
Security.allowInsecureDomain("*");
It could also have something to do with facebook changing security stuff. Every app needs to be run on a certified https server these days...