Images not displaying on other iOS devices - ios

I am having issues displaying images in my FlatList on other iPhones/iOS devices or iOS simulator. I can view the images on my iPhone but they do not show on other devices. I'm aware that the images are locally stored on my phone, and so I believe this may be the reason why I can see the images on my phone and not on others.
On the simulator the error below appears on initial render and the screen appears blank with no images:
Task orphaned for request <NSMutableURLRequest: 0x600...>
I am using react-native-image-crop-picker to get the pictures and and Firebase real-time database to store the images.
How do I view the images on other devices? Can someone please assist? I am fairly new to React Native. Please do let me know if you require more info.

Using react-native-image-crop-picker, you need to save the whole image on your database or on your storage, you can't save tha local path and pretending that other phone will see that image.
You have two possibility, the first one is to use firebase storage. When react-native-image-crop-picker give you the path, you can use that path to upload the image on firebase storage and save the downloadUrl on your document. Then you can use that downloadUrl to show the image on other phone.
The second one is to use the incluseBase64 prop on react-native-image-crop-picker and use that base64 string to show the image and save it to your database.

Related

React Native, storing images in users gallery without compression

I am developing an App that verifies images based on their hash. I hash the images using this library "react-native-fetch-blob".
I store all the images taken inside the app, I am trying to allow users to be able to share the original uncompressed image.
Problem: When using React-Native Camera roll or React native Share to save the image to my local gallery, compression is performed which changes the hash of the image if I recalculate it.
What I want to do, is to be able to save the image to the users local gallery without compressing the photo?
Any help would be very appreciated. :)
I have run tests retrieving the photos back into the app (from the user's normal gallery) using React-Native-Image-Picker; However, I believe that also forms some compression on the image. I have also used react-native-fetch-blob to copy the photo from the user photo gallery back into the app.
Can provide code I used to generate the below results if anyone needs that.
Hash Results - from Image Picker
camera roll save
10c30a42ead3636a8fd8cfd1eb6952db9f8bbb97fbbdccf96060b67f27be0766
fileSize: 591635,
React-Native share save image
cf799ba599e65a42905cb25fabc0150286ee923113da2af21ad7bb2a650bb86d
fileSize: 603288
Expected
Hash0802368f14296c4d6750a4fc853cda68de67b8e31adf16f38b0eabb7e8b28d0a
Thanks Again
Solved issue on react-native-camera-roll. Issue was stripping of meta-data on IOS side.
https://github.com/react-native-community/react-native-cameraroll/issues/125

How to get the image to show as preview for any website from its metadata in IOS

I am making a chat application and recently observed apps like WhatsApp,Viber,Skype when sent any link , the chat bubble changes from he text link to preview image with link as attached.
Can anyone tell me how to achieve it in IOS.
If your application has a server side api, this problem could be solved with server side making a preview thumbnail with a lower quality that would be sent to your client app, you would still need to manually keep track of what files you have stored this is where SDWebImage might come in handy (url: http://cocoadocs.org/docsets/SDWebImage/3.7.5/).
The problem is, there is no way to preview an image without actually downloading the data itself, so that's why my bet would be on the server side of that solution.

Capture a image and know the location of that image from where it was captured in iOS

I am going to design a app in iOS in which i have a functionality, whenever i capture a image from an iOS device that "image should not be saved in the camera roll" and "i need to know the exact location from where the image was captured that is street address, country, etc,.....". Any help would be appreciated.
Thanks in advance.
Exif Data is the partially hidden part of a photo file that most people don't think about when they upload a photo to a service like Dropbox or send a photo to a friend. This EXIF data includes the camera model you are using, basic settings of the camera when the picture was taken, the photo resolution and, if your camera has GPS, the location where the photo was taken.
You can extract the Exif data from image file (Get Exif data from UIImage - UIImagePickerController).
You can also view that data with Preview app on mac. To see go to Preview and click for info for image their you get GPS data for file.
It is correct that the iphone(ipad, etc, i'll just call it iphone from now on) strips exif data. This is also not a bug on the iphone but actually a feature.
One of the main reasons android users don't like the iphone and iphone users don't like the androids, is because the iphone is very limited (in terms of freedom to change, alter, etc). You can not just run downloaded apps, have limited access to settings, etc.
This is because the apple strategy is to create a fail-safe product. "If you can not do strange things, strange things will not happen".It tries to protect the user in every way imaginable. It also protects the user when uploading images. In the exif there may be data that can hurt the users privacy. Things like GPS coordinates, but even a timestamp can hurt a user (imagine you uploading a beach picture with a timestamp from a moment you reported in sick with the boss).
So basically it is a safety meassure to strip all exif data. Myself and a lot of other people do not agree with this strategy, but there is nothing we can do about it unfortunately.
The solution
Update: This does not work.
Luckily you can get around this problem. Javascript comes to the rescue. With javascript you can read the exif data and send it with you photo by adding some extra POST data.
please note: this solution was presented to me by another developer and is not yet tested.

Push image from client side to users in ViewController from parse framework?

I am creating a demo application that uses parse framework. i want to show images in my UIImageView from my developer parse account to all users installed my app. How can i achieve this?
Waiting for your help.
Thanks :)
There are 2 ways you can store images on parse:
1) Create an object with field imageURL (for example) and store link to an image. In this case you will need to load image by this URL in your app (you can use AFNetworking UIImageView category to do it in background).
In this case you will need additional api to store images on server (or S3)
2) You can save image data at Parse. There is good documentation you can use to build it this way Store Images at Parse.com

How should I store images if content will need to be synced with iCloud

I'm in the process of enabling iCloud support on my app and have encountered an issue. Within my content object that users create, they can choose a picture for their object. Currently I'm storing that image as binary data in coredata and am using the external storage option because in testing i've found that images can range from 1-3mb in size.
NOTE: I'm saving the data itself instead of a reference to the selected image so that a user cannot accidentally remove an image asset that they have added to my app's content object by removing an image from their photostream or camera roll.
While reading Apple's information on iCloud they mention not to store large downloaded data files. (source)
Given my current data structure seems to work without iCloud, how should I modify it so that I can incorporate iCloud for data syncing across devices? If Apple suggests not syncing large files, how should that data be sent between devices?
It depends on where the users choose these pictures from. Basically, if you don't send the image via iCloud, is there any other way you could get it?
If they come from some online source and they could be downloaded from there again, then you'd fall into the "large downloaded data files" category. Pass the URL or other details on how to re-do the download from one device to another and download again as needed.
If they come from some other source that's not readily available on another device (e.g. the user selected a photo from their camera roll), go ahead and pass it between devices as is. That would be more like a user document or data, not something you can re-download on demand.

Resources