Search Unity

NatShare - Free Sharing API

Discussion in 'Assets and Asset Store' started by Lanre, Apr 17, 2018.

  1. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    Unfortunately these logs don't show the reason for a crash, they just show that Unity is responsible "libunity.so". I'll need more information.
     
  2. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    NatShare expressly does not support this.
    NatShare is cross-platform, and as a result, it only exposes functionality that generalizes over all the platforms it supports (iOS and Android). PHAsset is specific to iOS. Your best bet is to create your own native library.
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    NatShare is free.
    NatShare doesn't use the Facebook SDK; it uses the native OS'es share sheet. As a result, it doesn't have Facebook-specific functionality.
     
  4. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    This error is from your NativeGallery plugin, not NatShare.
     
  5. xuchun9000

    xuchun9000

    Joined:
    Feb 24, 2017
    Posts:
    15
    hello Lanre:

    I just bought NatCorder, and am using one of your sample's code for recording AR Video on Android Phone, recording video works fine, but when I try to use NatShare.SaveToCameraRoll(path), it always return false.

    the code is very simple, I list them here:

    public void StartRecording()
    {
    // Start recording
    recordingClock = new RealtimeClock();
    videoRecorder = new MP4Recorder(
    videoWidth,
    videoHeight,
    30,
    recordMicrophone ? AudioSettings.outputSampleRate : 0,
    recordMicrophone ? (int)AudioSettings.speakerMode : 0,
    OnReplay
    );
    ........
    }

    private void OnReplay(string path)
    {
    Debug.Log("Saved recording to: " + path);
    Handheld.PlayFullScreenMovie(path);
    bool ok = NatShare.SaveToCameraRoll(path); // ok always be false
    }

    is there anything else I should concern?

    thanks
     
  6. xuchun9000

    xuchun9000

    Joined:
    Feb 24, 2017
    Posts:
    15

    ok, I fixed this, because I forget to enable android.permission.WRITE_EXTERNAL_STORAGE

    at the void Start()
    void Start()
    {
    AndroidPermissionsManager.RequestPermission("android.permission.WRITE_EXTERNAL_STORAGE");
    }
     
    Lanre likes this.
  7. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    You can set this in Player Settings.
     
  8. JoakimOlsson

    JoakimOlsson

    Joined:
    May 20, 2019
    Posts:
    11
    Moving a video to the camera roll on iOS using
    Code (CSharp):
    1. NatShare.SaveToCameraRoll(path, album: "Toptracer", copy: false);
    appears to rename the file. Having searched the web a bit I have begun to get the impression that iOS wants to be the boss of the file name when it comes to files being added to the camera roll.

    Have I understood this correctly? There is no way for us to control the file name when moving an image / video to the camera roll (using NatShare)?
     
  9. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    iOS doesn't really use file names in the photo library. There's no point in trying top control it.
     
    JoakimOlsson likes this.
  10. techartsmsm

    techartsmsm

    Joined:
    Jun 18, 2019
    Posts:
    26
    @Lanre I am using NatShare with iOS 13 and iPad Mini.

    When I want to share the recorded video, the app crashes, that's the log:



    [B]2019-07-24 01:13:27.090338+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.099489+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.099760+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.191819+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.191860+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.191887+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.191962+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.191989+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.192006+0200 samples[2082:701401] [Assert] Cannot be called with asCopy = NO on non-main thread.[/B]

    [B]2019-07-24 01:13:27.289701+0200 samples[2082:701401] [Animation] +[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior. trace=([/B]

    [B] 0 UIKitCore 0x00000001a5ecc220 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 15270432[/B]

    [B] 1 UIKitCore 0x00000001a5ecc2b8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 15270584[/B]

    [B] 2 libdispatch.dylib 0x00000001a16cf080 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 12416[/B]

    [B] 3 libdispatch.dylib 0x00000001a16d0768 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 18280[/B]

    [B] 4 UIKitCore 0x00000001a5ecc1a4 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 15270308[/B]

    [B] 5 UIKitCore 0x00000001a5ecc324 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 15270692[/B]

    [B] 6 UIKitCore 0x00000001a50fce28 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 790056[/B]

    [B] 7 UIKitCore 0x00000001a50fd378 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 791416[/B]

    [B] 8 UIKitCore 0x00000001a50fbfcc 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 786380[/B]

    [B] 9 UIKitCore 0x00000001a50f9b1c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 776988[/B]

    [B] 10 ShareSheet 0x00000001ad676ed4 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 130772[/B]

    [B] 11 ShareSheet 0x00000001ad67a7d4 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 145364[/B]

    [B] 12 ShareSheet 0x00000001ad67dea4 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 159396[/B]

    [B] 13 ShareSheet 0x00000001ad684300 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 185088[/B]

    [B] 14 UIKitCore 0x00000001a5417ec4 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4046532[/B]

    [B] 15 UIKitCore 0x00000001a541cadc 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4066012[/B]

    [B] 16 UIKitCore 0x00000001a541cec8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4067016[/B]

    [B] 17 UIKitCore 0x00000001a5432e74 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4157044[/B]

    [B] 18 UIKitCore 0x00000001a542b93c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4127036[/B]

    [B] 19 UIKitCore 0x00000001a542d328 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4133672[/B]

    [B] 20 UIKitCore 0x00000001a542f96c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143468[/B]

    [B] 21 UIKitCore 0x00000001a542fed0 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4144848[/B]

    [B] 22 UIKitCore 0x00000001a542f8b8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143288[/B]

    [B] 23 UIKitCore 0x00000001a542fb4c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143948[/B]

    [B] 24 Photos 0x00000001ad530604 971A785E-FA25-365C-B512-187539B76814 + 906756[/B]

    [B] 25 AssetsLibraryServices 0x00000001b6790c7c C70D807B-5FD2-37DD-B541-AB0FDB5148EA + 445564[/B]

    [B] 26 AssetsLibraryServices 0x00000001b675c128 C70D807B-5FD2-37DD-B541-AB0FDB5148EA + 229672[/B]

    [B] 27 libdispatch.dylib 0x00000001a16cdc24 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 7204[/B]

    [B] 28 libdispatch.dylib 0x00000001a16cf080 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 12416[/B]

    [B] 29 libdispatch.dylib 0x00000001a16d54f8 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 38136[/B]

    [B] 30 libdispatch.dylib 0x00000001a16d5f24 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 40740[/B]

    [B] 31 libdispatch.dylib 0x00000001a16def94 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 77716[/B]

    [B] 32 libsystem_pthread.dylib 0x00000001a173ae6c 1FE3BD15-61AF-3F0C-9CC8-2598FED6E7A3 + 40556[/B]

    [B] 33 libsystem_pthread.dylib 0x00000001a1734a30 1FE3BD15-61AF-3F0C-9CC8-2598FED6E7A3 + 14896[/B]

    [B] 34 libsystem_pthread.dylib 0x00000001a173ab88 start_wqthread + 8[/B]

    [B])[/B]

    [B]2019-07-24 01:13:27.304478+0200 samples[2082:701401] This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.[/B]

    [B] Stack:([/B]

    [B] 0 Foundation 0x00000001a1f10058 5F54DAFC-E48D-374F-A95D-218055C1D62A + 2326616[/B]

    [B] 1 Foundation 0x00000001a1d00ad8 5F54DAFC-E48D-374F-A95D-218055C1D62A + 166616[/B]

    [B] 2 UIKitCore 0x00000001a5e08fa8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14471080[/B]

    [B] 3 UIKitCore 0x00000001a5e0957c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14472572[/B]

    [B] 4 UIKitCore 0x00000001a5e08d5c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14470492[/B]

    [B] 5 UIKitCore 0x00000001a5e07e74 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14466676[/B]

    [B] 6 UIKitCore 0x00000001a5e094fc 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14472444[/B]

    [B] 7 UIKitCore 0x00000001a5dfd0a8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14422184[/B]

    [B] 8 UIKitCore 0x00000001a5dfd70c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14423820[/B]

    [B] 9 Foundation 0x00000001a1cffb90 5F54DAFC-E48D-374F-A95D-218055C1D62A + 162704[/B]

    [B] 10 ShareSheet 0x00000001ad6778c8 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 133320[/B]

    [B] 11 ShareSheet 0x00000001ad67a7d4 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 145364[/B]

    [B] 12 ShareSheet 0x00000001ad67dea4 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 159396[/B]

    [B] 13 ShareSheet 0x00000001ad684300 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 185088[/B]

    [B] 14 UIKitCore 0x00000001a5417ec4 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4046532[/B]

    [B] 15 UIKitCore 0x00000001a541cadc 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4066012[/B]

    [B] 16 UIKitCore 0x00000001a541cec8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4067016[/B]

    [B] 17 UIKitCore 0x00000001a5432e74 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4157044[/B]

    [B] 18 UIKitCore 0x00000001a542b93c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4127036[/B]

    [B] 19 UIKitCore 0x00000001a542d328 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4133672[/B]

    [B] 20 UIKitCore 0x00000001a542f96c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143468[/B]

    [B] 21 UIKitCore 0x00000001a542fed0 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4144848[/B]

    [B] 22 UIKitCore 0x00000001a542f8b8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143288[/B]

    [B] 23 UIKitCore 0x00000001a542fb4c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143948[/B]

    [B] 24 Photos 0x00000001ad530604 971A785E-FA25-365C-B512-187539B76814 + 906756[/B]

    [B] 25 AssetsLibraryServices 0x00000001b6790c7c C70D807B-5FD2-37DD-B541-AB0FDB5148EA + 445564[/B]

    [B] 26 AssetsLibraryServices 0x00000001b675c128 C70D807B-5FD2-37DD-B541-AB0FDB5148EA + 229672[/B]

    [B] 27 libdispatch.dylib 0x00000001a16cdc24 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 7204[/B]

    [B] 28 libdispatch.dylib 0x00000001a16cf080 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 12416[/B]

    [B] 29 libdispatch.dylib 0x00000001a16d54f8 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 38136[/B]

    [B] 30 libdispatch.dylib 0x00000001a16d5f24 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 40740[/B]

    [B] 31 libdispatch.dylib 0x00000001a16def94 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 77716[/B]

    [B] 32 libsystem_pthread.dylib 0x00000001a173ae6c 1FE3BD15-61AF-3F0C-9CC8-2598FED6E7A3 + 40556[/B]

    [B] 33 libsystem_pthread.dylib 0x00000001a1734a30 1FE3BD15-61AF-3F0C-9CC8-2598FED6E7A3 + 14896[/B]

    [B] 34 libsystem_pthread.dylib 0x00000001a173ab88 start_wqthread + 8[/B]

    [B])[/B]

    [B]2019-07-24 01:13:27.311293+0200 samples[2082:701401] Uncaught exception: NSInternalInconsistencyException: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.[/B]

    [B]([/B]

    [B] 0 CoreFoundation 0x00000001a1a27354 517BD051-249C-3BC3-BBCD-E64783E9CC11 + 1254228[/B]

    [B] 1 libobjc.A.dylib 0x00000001a1742388 objc_exception_throw + 60[/B]

    [B] 2 Foundation 0x00000001a1f100e8 5F54DAFC-E48D-374F-A95D-218055C1D62A + 2326760[/B]

    [B] 3 Foundation 0x00000001a1d00ad8 5F54DAFC-E48D-374F-A95D-218055C1D62A + 166616[/B]

    [B] 4 UIKitCore 0x00000001a5e08fa8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14471080[/B]

    [B] 5 UIKitCore 0x00000001a5e0957c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14472572[/B]

    [B] 6 UIKitCore 0x00000001a5e08d5c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14470492[/B]

    [B] 7 UIKitCore 0x00000001a5e07e74 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14466676[/B]

    [B] 8 UIKitCore 0x00000001a5e094fc 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14472444[/B]

    [B] 9 UIKitCore 0x00000001a5dfd0a8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14422184[/B]

    [B] 10 UIKitCore 0x00000001a5dfd70c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 14423820[/B]

    [B] 11 Foundation 0x00000001a1cffb90 5F54DAFC-E48D-374F-A95D-218055C1D62A + 162704[/B]

    [B] 12 ShareSheet 0x00000001ad6778c8 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 133320[/B]

    [B] 13 ShareSheet 0x00000001ad67a7d4 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 145364[/B]

    [B] 14 ShareSheet 0x00000001ad67dea4 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 159396[/B]

    [B] 15 ShareSheet 0x00000001ad684300 DFB470DB-AC8B-33EA-98C8-1DB9EF927F81 + 185088[/B]

    [B] 16 UIKitCore 0x00000001a5417ec4 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4046532[/B]

    [B] 17 UIKitCore 0x00000001a541cadc 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4066012[/B]

    [B] 18 UIKitCore 0x00000001a541cec8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4067016[/B]

    [B] 19 UIKitCore 0x00000001a5432e74 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4157044[/B]

    [B] 20 UIKitCore 0x00000001a542b93c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4127036[/B]

    [B] 21 UIKitCore 0x00000001a542d328 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4133672[/B]

    [B] 22 UIKitCore 0x00000001a542f96c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143468[/B]

    [B] 23 UIKitCore 0x00000001a542fed0 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4144848[/B]

    [B] 24 UIKitCore 0x00000001a542f8b8 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143288[/B]

    [B] 25 UIKitCore 0x00000001a542fb4c 15FE3BB2-ABD9-33D1-8641-E04B229B3F7A + 4143948[/B]

    [B] 26 Photos 0x00000001ad530604 971A785E-FA25-365C-B512-187539B76814 + 906756[/B]

    [B] 27 AssetsLibraryServices 0x00000001b6790c7c C70D807B-5FD2-37DD-B541-AB0FDB5148EA + 445564[/B]

    [B] 28 AssetsLibraryServices 0x00000001b675c128 C70D807B-5FD2-37DD-B541-AB0FDB5148EA + 229672[/B]

    [B] 29 libdispatch.dylib 0x00000001a16cdc24 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 7204[/B]

    [B] 30 libdispatch.dylib 0x00000001a16cf080 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 12416[/B]

    [B] 31 libdispatch.dylib 0x00000001a16d54f8 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 38136[/B]

    [B] 32 libdispatch.dylib 0x00000001a16d5f24 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 40740[/B]

    [B] 33 libdispatch.dylib 0x00000001a16def94 4DEFEF54-4DE0-35EC-BB0E-32138324C258 + 77716[/B]

    [B] 34 libsystem_pthread.dylib 0x00000001a173ae6c 1FE3BD15-61AF-3F0C-9CC8-2598FED6E7A3 + 40556[/B]

    [B] 35 libsystem_pthread.dylib 0x00000001a1734a30 1FE3BD15-61AF-3F0C-9CC8-2598FED6E7A3 + 14896[/B]

    [B] 36 libsystem_pthread.dylib 0x00000001a173ab88 start_wqthread + 8[/B]

    [B])[/B]

    [B]2019-07-24 01:13:27.311939+0200 samples[2082:701401] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.'[/B]

    [B]*** First throw call stack:[/B]

    [B](0x1a1a27340 0x1a1742388 0x1a1f100e8 0x1a1d00ad8 0x1a5e08fa8 0x1a5e0957c 0x1a5e08d5c 0x1a5e07e74 0x1a5e094fc 0x1a5dfd0a8 0x1a5dfd70c 0x1a1cffb90 0x1ad6778c8 0x1ad67a7d4 0x1ad67dea4 0x1ad684300 0x1a5417ec4 0x1a541cadc 0x1a541cec8 0x1a5432e74 0x1a542b93c 0x1a542d328 0x1a542f96c 0x1a542fed0 0x1a542f8b8 0x1a542fb4c 0x1ad530604 0x1b6790c7c 0x1b675c128 0x1a16cdc24 0x1a16cf080 0x1a16d54f8 0x1a16d5f24 0x1a16def94 0x1a173ae6c 0x1a1734a30 0x1a173ab88)[/B]

    [B]libc++abi.dylib: terminating with uncaught exception of type NSException[/B]

    [B](lldb) [/B]


     
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    Track this issue here.
     
  12. ElliotCurtis

    ElliotCurtis

    Joined:
    Nov 26, 2018
    Posts:
    13
    I am saving a file to the camera roll, which is working fine, but I need to add a time stamp or a unique identifier of some sort, because a new .gif file is saved over the old one because the file name is the same.
    But this needs to happen when the file is being saved to the gallery, rather than when it is created.
    Has anyone done this?
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    I'm working on a PR that should implicitly fix this.
     
  14. DORNE

    DORNE

    Joined:
    Jul 4, 2017
    Posts:
    10
    Hi, and is it possible to share a gif for facebook post ? it seems to work on whats'app, mail but facebook shows just the first image of the gif ? (I use the function NatShareU.NatShare.Share(path, callback: _OnShareCallback); and the path points to a gif )
    Thanks !
     
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    This is out of scope of NatShare. It is up to the receiving app to do what it wants with the share payload, and it seems Facebook doesn't support GIF's.
     
  16. ElliotCurtis

    ElliotCurtis

    Joined:
    Nov 26, 2018
    Posts:
    13
    OK, so my gif is saved to the assets folder and then moved to the camera roll using this bit of Natshare:

    public static bool SaveToCameraRoll (string path, string album = "", bool copy = false) {
    if (string.IsNullOrEmpty(path)) {
    Debug.LogError("NatShare Error: Path to media file is invalid");
    return false;
    }
    return Implementation.SaveToCameraRoll(path, album ?? "", copy);
    }

    However, the first time I do it, the image does not get moved, but when I do it a second time, it works.
    The first time it gets shared it asks for permission:

    public void OnGalleryButtonPressed() {
    #if UNITY_ANDROID
    if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageWrite)) {
    Permission.RequestUserPermission(Permission.ExternalStorageWrite);
    }
    if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageRead)) {
    Permission.RequestUserPermission(Permission.ExternalStorageRead);
    }
    #endif

    Debug.Log("Gallery sharing selected.");
    string path = getPath(ProGifManager.Instance.GifName + ".gif");
    NatShare.SaveToCameraRoll(path);
    hide();
    }

    Maybe this is stopping it working, but I don't see how.

    Any help please?!
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    I don't think the RequestUserPermission method blocks until the user has responded, so the permission is probably not granted yet by the time you call NatShare.SaveToCameraRoll.
     
  18. ElliotCurtis

    ElliotCurtis

    Joined:
    Nov 26, 2018
    Posts:
    13
    Thanks Lanre- that's what I was thinking.
    But how would I ensure that the method is called after permission is granted?
    Thanks
     
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    Don't proceed to save until HasUserAuthorizedPermission is true. You can use a coroutine for this.
     
  20. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    707
    Hello, Can this free plugin be used to allow the user to open and select a photo or video from the phone gallery (Android and iOS) and then return the path to the selected photo or video the unity app?
     
  21. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    NatShare is not a gallery picker so it does not support this.
     
  22. poshaughnessey

    poshaughnessey

    Joined:
    Jul 12, 2012
    Posts:
    40
    Hello, I am getting the following error on Android when attempting to share:

    "E/Unity: Can't find ContentProvider, share not possible!"

    Am I missing something in my AndroidManifest.xml setup? I am using Unity 2018.3.0f2 and testing on a Samsung Galaxy Note S10+ with Android 9.

    Thanks!
     
  23. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    This log doesn't look to have anything to do with NatShare. NatShare error logs are prepended by "NatShare Error: ..."
     
  24. poshaughnessey_mozilla

    poshaughnessey_mozilla

    Joined:
    Sep 17, 2019
    Posts:
    1
    My apologies! I just realized that even though we are using NatCorder for screen recording, we had switched to NativeShare for sharing a while back.
     
    Last edited: Sep 20, 2019
    Lanre likes this.
  25. LeeLorenzSr

    LeeLorenzSr

    Joined:
    May 3, 2015
    Posts:
    24
    Any special tricks to get Save to camera roll working on Android 9?
     
  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    There's a PR in progress for this. I'm going to implement saving to the camera roll on Android soon.
     
    LeeLorenzSr likes this.
  27. andrewdSuper77

    andrewdSuper77

    Joined:
    Jul 12, 2019
    Posts:
    15
    Looks like iOS 13 is having issues with the current version of natshare, does work with iOS 12 still
     
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    Can you be more descriptive? What issues are you facing?
     
  29. andrewdSuper77

    andrewdSuper77

    Joined:
    Jul 12, 2019
    Posts:
    15
    Certainly. I am recording an mp4 using the NatShare using MP4 recorder. I am able to preview the video successfully in editor, so it does not appear to be a video corruption, and when I run the function NatShare.Share(m_PathToLastVideo); if gives me two different outcomes depending on iOS version.

    iOS 13: crashes Application
    iOS 12.4.1: Pulls up iOS native sharing allowing me to select an app to share too. Most work successfully. Slack for example does not, but not one of our target platforms to support sharing for, so it doesn't bother us too much.
     
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    Can you try pulling the `payload-api` branch? This issue should have been fixed by the latest API.
     
  31. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    112
    @Lanre

    Using Unity 2019.1 and NatShare: our current situation is that we are using your payload-api branch for iOS to fix iOS 13 issues (this works), however, the payload-api branch is unfortunately not working on Android so we have to revert to the 1.2 branch for Android.

    The issues on Android we are seeing are the following:

    - Save Image or Video doesn't work at all on Android.
    - Share Image takes a very long time (5+ seconds) to pull up the share sheet.
    - Share image shows the image flipped vertically (y-axis reversed).
     
  32. andrewdSuper77

    andrewdSuper77

    Joined:
    Jul 12, 2019
    Posts:
    15
    Tested with new branch and payload system. iOS 13, iphone 6s.
    Successful recording on device, Successfully Brings up Share options. Successfully shared to Slack and iOS Messages. Save to device through iOS share menu crashes app. Returning from native share menu crashes the app. Returning from successful share also crashes the app
     
    kkiruk likes this.
  33. LeeLorenzSr

    LeeLorenzSr

    Joined:
    May 3, 2015
    Posts:
    24
    So I'm just on the current Asset Store version, and I've bene playing around with this to get it to save my video recordings to the Camera Roll, and I get the following:

    Code (CSharp):
    1. java.io.FileNotFoundException: /storage/emulated/0/DCIM/Videos/recording_2019_10_03_23_13_41_155.mp4 (No such file or directory)
    That was with album="Videos"

    Looking through ES File Manager, I see there is no "Videos" folder in the DCIM folder. Creating one, I get a permissions error. Changing my album to point to "Camera" which IS there, I also get a permissions error:

    Code (CSharp):
    1. java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/recording_2019_10_03_23_31_21_805.mp4 (Permission denied)
    So what am I missing? Is there an Android permission I need to be asking for to get this to save to camera roll?

    Also, in the NatShare java code, I don't see where it will create a folder for the album if it doesn't exist. There is certainly a "Videos" album in my photos, but that's the new Android photos, and it's cloud based, it looks like. Maybe this is a problem with the newer versions of Android?
     
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    I haven't worked on the SavePayload as much. Will hopefully get this done this weekend.
    This is because of Android's image compression to PNG. I've reverted to relying on Unity for this (same as NatShare 1.1).
    Similarly things are back to normal since I'm encoding in Unity instead of in Android Java. Grab the latest commit.
     
  35. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    Can you share a screenshot of the Xcode window when the crash occurs?
     
  36. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    You are trying to save a video that is supposedly already in the camera roll to the camera roll. Can you show your sharing code?
     
    CuentinTest likes this.
  37. kkiruk

    kkiruk

    Joined:
    Sep 7, 2015
    Posts:
    7
    There is a problem with "save" function.
    Just use save function, crash occurs.
    When use share function, share screen pops, when I click the "Save" then crash occurs.


    UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String: AppControllerClassName]);
    Thread 1: signal SIGABRT



    payload version, ios13.1.1, xcode 11.0, unity 2018.3.13f1
     
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    Can you share a screenshot of the Xcode window when the crash occurs? I need to see the stack trace. Also, make sure you have added a photo library usage description to your Info.plist.
     
  39. kkiruk

    kkiruk

    Joined:
    Sep 7, 2015
    Posts:
    7
    Here is a screenshot. (iPhone XS Max, iOS 13.1.1) Also, I added the description.

    I test iPhone6s, iOS 12.1 and it has exact same error occurs.
     

    Attached Files:

  40. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    The `Il2CppExceptionWrapper` indicates that the crash is coming from .NET. If your share code does other things, then check that you don't have something in there that could throw an exception. I'll try to reproduce on my end.
     
  41. kvzantenisaac

    kvzantenisaac

    Joined:
    Sep 5, 2017
    Posts:
    7
    We have the same issue on an iPhone 7 running iOS 13.1.2. A hard crash when the Share is called.

    This is the error from Xcode

     
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    What version of NatShare are you using?
     
  43. sucko

    sucko

    Joined:
    Jun 17, 2016
    Posts:
    5
    Hello, how would i go about replacing the old version of NatShare from the AssetStore with the PullRequest#49?
    I downloaded the zip and tried replacing the Assets Folder from my Project, but Unity could not find the Namespace after that. Sorry if that question is stupid, a pointer in the right direction would certainly help.
     
  44. kvzantenisaac

    kvzantenisaac

    Joined:
    Sep 5, 2017
    Posts:
    7
    We are using version 1.1f3. In the meantime I have switched to a different library, but as we are also using the "save to camera roll" feature, it would be nice to be able to use your asset for both sharing and saving.
     
  45. zmmround

    zmmround

    Joined:
    Oct 15, 2018
    Posts:
    7
    Hi. I'm looking to buy NatCorder and use with NatShare. Will it allow me to save video files to an external NAS from an iPad Unity App?
     
  46. youngsangcho

    youngsangcho

    Joined:
    Jul 6, 2018
    Posts:
    1
    @Lanre

    Using Unity 2019.2.8f1, NatCorder 1.6.2 and NatShare 1.1f3

    NatShare.SaveToCameraRoll(path) works fine on iOS12, but not on iOS11.0.3.
    The function returns true, but no video shows up in photo library.
     
  47. kkiruk

    kkiruk

    Joined:
    Sep 7, 2015
    Posts:
    7
    It's working after your commit. Thank you very much.
    I got another problem. Can you save gif? It's not working for me to use AddMedia (but video works well even share the code with gif).
     
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    The namespace has been changed from NatShareU to NatShare. You only need to copy the NatShare folder in Assets to your project's Assets folder.
     
    cubemap likes this.
  49. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    This has been fixed in the payload-api PR.
     
  50. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,779
    I responded to your email. NatCorder will always save videos to the app's private documents directory. It is then up to you to copy/move it to your external NAS.
     
    zmmround likes this.
unityunity