npomfret / react-native-image-tools

Image editing software powered by Abode Creative SDK for iOS and Android.
171 stars 41 forks source link

iOS throws an error while assets-library is the source of image. #9

Closed srameshr closed 6 years ago

srameshr commented 7 years ago
index.ios.bundle?platform=ios&dev=true&minify=false:10560 Exception '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[5]' was thrown while invoking openEditor on target RNImageTools with params (
        {
        imageUri = "assets-library://asset/asset.JPG?id=9F983DBA-EC35-42B8-8773-B597CF782EDD&ext=JPG";
        quality = 90;
        saveTo = photo;
    },
    3524,
    3525
)

The plugin works fine if I provide, http or file:// uri.

srameshr commented 7 years ago

@npomfret Could you look into this?

npomfret commented 7 years ago

Will do, don't think it's a difficult fix but am struggling for time at the moment.

srameshr commented 7 years ago

@npomfret Thank you! This and accepting array of tools would really help!

srameshr commented 7 years ago

@npomfret Any updates on this?

srameshr commented 7 years ago

@npomfret If its a simple fix can you please look into this. I went over iOS code, but I am not able to figure it out. I have never used objective-c

srameshr commented 7 years ago

Anybody able to fix this damn thing?

srameshr commented 7 years ago

I fixed it with the help of an iOS dev friend. This occurs on iOS 9.0 because of this line

 NSISO8601DateFormatter *dateFormatter = [[NSISO8601DateFormatter alloc] init];

This formatter is iOS 10+ only.

Replaced it with:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"h:mm a, d MMM";
    NSString *timestamp = [formatter stringFromDate:creationDate];
YahyaBagia commented 6 years ago

You have to link CameraRoll (RN's library) to your iOS project. See this SO link for instructions.

srameshr commented 6 years ago

This is a better one https://github.com/prscX/react-native-photo-editor/issues/1

npomfret commented 6 years ago

@srameshr thanks for the link - hope this is of use to people.

srameshr commented 6 years ago

@npomfret Could you put it in your readme file?