IOS : Selected image is empty
See original GitHub issueWhich platform(s) does your issue occur on?
- iOS
- emulator or device. What type of device? Tested on :
- IOS 10.2 on iPhone 6
- IOS 11.4 on iPhine 8 Plus
Please, provide the following version numbers that your issue occurs with:
- CLI: (run
tns --versionto fetch it) 4.1.1 - Cross-platform modules: (check the ‘version’ attribute in the
node_modules/tns-core-modules/package.jsonfile in your project)
“tns-core-modules”: “^4.1.0”,
- Runtime(s): (look for the
"tns-android"and"tns-ios"properties in thepackage.jsonfile of your project)
“tns-android”: { “version”: “4.1.3” }, “tns-ios”: { “version”: “4.1.1” }
- Plugin(s): (look for the version numbers in the
package.jsonfile of your project and paste your dependencies and devDependencies here)
“devDependencies”: { “babel-traverse”: “6.26.0”, “babel-types”: “6.26.0”, “babylon”: “6.18.0”, “lazy”: “1.0.11”, “nativescript-dev-typescript”: “^0.7.1”, “typescript”: “~2.6.2” }
Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
I use your code with onSelectSingleTap method :
private startSelection(context) {
context
.authorize()
.then(() => {
this.imageAssets = [];
this.imageSrc = null;
return context.present();
})
.then((selection) => {
console.log("Selection done: " + JSON.stringify(selection));
this.imageSrc = this.isSingleMode && selection.length > 0 ? selection[0] : null;
// set the images to be loaded from the assets with optimal sizes (optimize memory usage)
selection.forEach(element => {
element.options.width = this.isSingleMode ? this.previewSize : this.thumbSize;
element.options.height = this.isSingleMode ? this.previewSize : this.thumbSize;
});
this.imageAssets = selection;
}).catch(function (e) {
console.log(e);
});
}
Is there any code involved?
- provide a code example to recreate the problem
- (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.
On IOS i get this after select image :
[{"_observers":{},"_options":{"keepAspectRatio":true},"_ios":{}}]
It work fine on android
Thank you
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10
Top Results From Across the Web
My iPhone 5 camera roll is empty, but und… - Apple Community
Open it, "Select" and start deleting; Now, go back into Settings - General - Usage - Storage - Manage Storage - and you'll...
Read more >Selecting photo returns to blank UI - Stack Overflow
The first thing I am trying to do is enable the user to select an image that they want for upload. EDIT 6....
Read more >image_picker | Flutter Package - Pub.dev
Flutter plugin for selecting images from the Android and iOS image library, and taking new pictures with the camera.
Read more >Crop images in Photoshop Elements - Adobe Support
To select a crop ratio other than that of the original photo, ... Crops the image to remove any blank background area that...
Read more >Empty .MOV file, stuck on iPhone - Ask Different
The movie plays normally in Preview.app on the Mac. I cannot select the file in Image Capture, so I cannot click the Delete...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi,
I have done some research on this issue, and here is how I fixed it
You can see that first, I use the TNS imageSourceModule so don’t forget to declare it at the top.
const imageSourceModule = require("tns-core-modules/image-source");I use the fromAsset function directly on the “selected” because apparently with the new version of this plugin, “selected” is an Asset. So you got an imageSource and you can use the “saveToFile” function that will copy the Asset into a new location (get this location using fileSystemModule from TNS). Use the path of this new location for your UI, and the image will appear. You can also create a file object from this location ( fileSystemModule.File.fromPath(path); ), I use for upload.
I can help if you need more information.
i am also having the same issue any fixes.