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,853
    I'll reopen the issue and keep searching for fixes.
     
  2. AlexeySeverin

    AlexeySeverin

    Joined:
    Oct 6, 2016
    Posts:
    11
    Could you maybe add the GetThumbnail() function back until NatReader is finalized? The description says "INCOMPLETE", demo scene gives errors and the documentation is basically nonexistent.
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    The top level README is empty but not the package README. Also see the included example.
     
  4. AlexeySeverin

    AlexeySeverin

    Joined:
    Oct 6, 2016
    Posts:
    11
    Well, as I already wrote in the corresponding forum thread, the demo scene gives me an "EntryPointNotFoundException: NRCreateMP4FrameReader" error.
    Could you at least please explain (here or in NatReader thread) in a beginner-friendly way how to acheive a result similar to the old "NatShare.GetThumbnail()" function using NatReader? How do you get a single frame as a texture instead of displaying all frames in a sequence like the example is supposed to do? Thanks in advance.
     
  5. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    The Windows backend for NatReader isn't complete. NatReader currently only works on iOS, Android, and macOS. To get a single frame instead of all of them, simply break out of the loop.
     
  6. timbokoppers

    timbokoppers

    Joined:
    Nov 14, 2016
    Posts:
    31
    I have the same issue, happens on iOS 13. When cancelling an app (for example mail) in the native share dialog and then share through another app (whatsapp) it crashes. Only happen if you can and then share again,.

    Code (CSharp):
    1.  
    2. 2020-02-03 17:43:16.954810+0100 realmoji[44961:7191873] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    3.     Probably at least one of the constraints in the following list is one you don't want.
    4.    Try this:
    5.        (1) look at each constraint and try to figure out which you don't expect;
    6.         (2) find the code that added the unwanted constraint or constraints and fix it.
    7. (
    8.     "<NSLayoutConstraint:0x28294b3e0 _UIActivityActionCellTitleLabel:0x129863460.height >= 22   (active)>",
    9.     "<NSLayoutConstraint:0x28294af30 V:|-(15)-[_UIActivityActionCellTitleLabel:0x129863460]   (active, names: '|':UIView:0x129863130 )>",
    10.     "<NSLayoutConstraint:0x28294af80 V:[_UIActivityActionCellTitleLabel:0x129863460]-(15)-|   (active, names: '|':UIView:0x129863130 )>",
    11.     "<NSLayoutConstraint:0x2829119f0 'UIView-Encapsulated-Layout-Height' UIView:0x129863130.height == 49.3333   (active)>"
    12. )
    13.  
    14. Will attempt to recover by breaking constraint
    15. <NSLayoutConstraint:0x28294b3e0 _UIActivityActionCellTitleLabel:0x129863460.height >= 22   (active)>
    16.  
    17. Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    18. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    19. 2020-02-03 17:43:16.989313+0100 realmoji[44961:7191873] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    20.     Probably at least one of the constraints in the following list is one you don't want.
    21.    Try this:
    22.        (1) look at each constraint and try to figure out which you don't expect;
    23.         (2) find the code that added the unwanted constraint or constraints and fix it.
    24. (
    25.     "<NSLayoutConstraint:0x28294e350 _UIActivityActionCellTitleLabel:0x11e8c4420.height >= 22   (active)>",
    26.     "<NSLayoutConstraint:0x28294dea0 V:|-(15)-[_UIActivityActionCellTitleLabel:0x11e8c4420]   (active, names: '|':UIView:0x11e8c3cf0 )>",
    27.     "<NSLayoutConstraint:0x28294def0 V:[_UIActivityActionCellTitleLabel:0x11e8c4420]-(15)-|   (active, names: '|':UIView:0x11e8c3cf0 )>",
    28.     "<NSLayoutConstraint:0x282911630 'UIView-Encapsulated-Layout-Height' UIView:0x11e8c3cf0.height == 49.3333   (active)>"
    29. )
    30.  
    31. Will attempt to recover by breaking constraint
    32. <NSLayoutConstraint:0x28294e350 _UIActivityActionCellTitleLabel:0x11e8c4420.height >= 22   (active)>
    33.  
    34. Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    35. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    36. 2020-02-03 17:43:16.991182+0100 realmoji[44961:7191873] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    37.     Probably at least one of the constraints in the following list is one you don't want.
    38.    Try this:
    39.        (1) look at each constraint and try to figure out which you don't expect;
    40.         (2) find the code that added the unwanted constraint or constraints and fix it.
    41. (
    42.     "<NSLayoutConstraint:0x282963020 _UIActivityActionCellTitleLabel:0x129871e50.height >= 22   (active)>",
    43.     "<NSLayoutConstraint:0x282962b70 V:|-(15)-[_UIActivityActionCellTitleLabel:0x129871e50]   (active, names: '|':UIView:0x129871b20 )>",
    44.     "<NSLayoutConstraint:0x282962bc0 V:[_UIActivityActionCellTitleLabel:0x129871e50]-(15)-|   (active, names: '|':UIView:0x129871b20 )>",
    45.     "<NSLayoutConstraint:0x282911db0 'UIView-Encapsulated-Layout-Height' UIView:0x129871b20.height == 49.3333   (active)>"
    46. )
    47.  
    48. Will attempt to recover by breaking constraint
    49. <NSLayoutConstraint:0x282963020 _UIActivityActionCellTitleLabel:0x129871e50.height >= 22   (active)>
    50.  
    51. Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    52. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
    53. Successfully shared items: False
    54. FaceActing.<CaptureScreen>d__13:System.Collections.IEnumerator.get_Current()
    55. System.Threading.ContextCallback:Invoke(Object)
    56. System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
    57. System.Runtime.CompilerServices.MoveNextRunner:Run()
    58. System.Action:Invoke()
    59. System.Threading.ContextCallback:Invoke(Object)
    60. System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
    61. System.Threading.Tasks.Task:FinishContinuations()
    62. System.Threading.Tasks.Task`1:TrySetResult(TResult)
    63. System.Threading.Tasks.TaskCompletionSource`1:TrySetResult(TResult)
    64. System.Threading.Tasks.TaskCompletionSource`1:SetResult(TResult)
    65. NatShare.Internal.NativePayload:OnCompletion(IntPtr, Boolean)
    66. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    67.  
    68. 2020-02-03 17:43:40.263659+0100 realmoji[44961:7192450] [ShareSheet] connection invalidated
    69. libc++abi.dylib: terminating with uncaught exception of type Il2CppExceptionWrapper
    70. (lldb)
     
  7. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    Add an exception breakpoint in Xcode and share a screenshot of the stack trace. The Il2CppExceptionWrapper means that the exception is coming from C#, not from Objective-C.
     
  8. HankHongChen

    HankHongChen

    Joined:
    Jan 19, 2016
    Posts:
    3
    Hi, thanks for making NatShare FREE!
    I get some problem with share multiple items at once. Hope you can help.

    Here are my codes.

    Texture2D texture = ScreenCapture.CaptureScreenshotAsTexture();
    using (var payload = new SharePayload())
    {
    payload.AddText("Share test");
    payload.AddImage(texture);
    //payload.Dispose();
    }

    I ran the test on iOS 13.
    Thing is that, when I share it on whatsapp, I can only saw the test, and when I share it on wechat, I can only saw the Picture. If I share it on Messages, I can saw them all.

    Is this a bug or not cause currently I will need a share function that can share Images and text at once?
    Thanks.
     
  9. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    This is not a bug. The receiving app decides what to take and what to leave.
     
  10. lordzeon

    lordzeon

    Joined:
    Jun 1, 2018
    Posts:
    25
    Hi, im trying to make natcorder work with shareSDK, im having a problem when i try to share to instagram, "History" don´t open IG app and "feed" open IG but nothing happen, but there is no error log, for facebook, the same works normally, maybe the path to share should be different for instagram sharing? im trying this in android phone and it is very important for my app to record and share in instagram, do you know how to solve this?
     
    AlexeySeverin likes this.
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    The receiving app is responsible for taking what it wants from the share payload. I don't know that there is any way to force Instagram to take whatever you add to the payload.
     
  12. lordzeon

    lordzeon

    Joined:
    Jun 1, 2018
    Posts:
    25
    Thanks for answering, the weir thing is that if i go to file explorer or any other app in the device, i could make the same with the saved video and instagram take the video without problem, that is why i think that maybe there is one extra step or url formatting other apps are doing differently.
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    If your goal is to only share video, then you might be able to get it to work by hard-coding the MIME type to "video/mp4". You can clone or fork NatShare and test out any modifications you make.
     
  14. jose_pedro_didimo

    jose_pedro_didimo

    Joined:
    May 2, 2018
    Posts:
    14
    I am also having issues with iOS 13.3. I upgraded to the latest NatShare version but it did not solve the issue.

    Code (CSharp):
    1. Presenting view controllers on detached view controllers is discouraged <UnityPortraitOnlyViewController: 0x14fe62640>.
    2. [LayoutConstraints] Unable to simultaneously satisfy constraints.
    3. Probably at least one of the constraints in the following list is one you don't want.
    4. Try this:
    5. (1) look at each constraint and try to figure out which you don't expect;
    6. (2) find the code that added the unwanted constraint or constraints and fix it.
    7. (
    8.  
    9.     "<NSLayoutConstraint:0x28365def0 LPLinkView:0x151e3db30.leading == UILayoutGuide:0x282f988c0'UIViewLayoutMarginsGuide'.leading   (active)>",
    10.  
    11.     "<NSLayoutConstraint:0x28365dd10 H:[LPLinkView:0x151e3db30]-(59)-|   (active, names: '|':_UIActivityContentTitleView:0x151e3e4a0 )>",
    12.  
    13.     "<NSLayoutConstraint:0x283667bb0 H:|-(0)-[_UIActivityContentTitleView:0x151e3e4a0]   (active, names: '|':_UINavigationBarContentView:0x151e47f90 )>",
    14.  
    15.     "<NSLayoutConstraint:0x283667c00 _UIActivityContentTitleView:0x151e3e4a0.trailing == _UINavigationBarContentView:0x151e47f90.trailing   (active)>",
    16.  
    17.     "<NSLayoutConstraint:0x28364f160 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x151e47f90.width == 0   (active)>",
    18.  
    19.     "<NSLayoutConstraint:0x28365d310 'UIView-leftMargin-guide-constraint' H:|-(16)-[UILayoutGuide:0x282f988c0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIActivityContentTitleView:0x151e3e4a0 )>"
    20. )
    21.  
    22. Will attempt to recover by breaking constraint
    23. <NSLayoutConstraint:0x28365def0 LPLinkView:0x151e3db30.leading == UILayoutGuide:0x282f988c0'UIViewLayoutMarginsGuide'.leading   (active)>
    24. Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
    25.  
    26. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
     
  15. Zed67

    Zed67

    Joined:
    Jun 1, 2018
    Posts:
    2
    Sorry posted this on the NatCorder thread by mistake,does anyone know how I would be able to add Instagram stories to the share list on the native popup? I see the standard Instagram wall option only but I'm trying to mimic say Spotify or TikTok which allows you to distinguish between the 2. Thanks!
     
  16. lordzeon

    lordzeon

    Joined:
    Jun 1, 2018
    Posts:
    25
    that must be!, im very rusty with java development, i don´t even have a IDE installed, there is any chance you could expose the MIME type to the Asset? i bought NatCorder because i thought it will integrate perfectly with NatShare, i know is not a bug, just a small feature that could be good for both assets.... aaaandd i will owe you a beer :)
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    We still haven't found a fix for this. It seems to be some incompatibility between the share sheet and the Unity view controller.
     
  18. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    I can't expose the MIME to the front-end API because it is an Android-specific detail. This is a modification you'd make yourself for your specific use case.
     
  19. Meneghetti

    Meneghetti

    Joined:
    Aug 26, 2014
    Posts:
    3
    Hello!

    (EDIT Below!)
    I'm using NatShare with NatCorder, but I'm unable to share .mp4 files...

    Here's what I got (lastRecPath is the path to the file with the extension):

    Code (CSharp):
    1. using (var payload = new SharePayload(
    2.                 completionHandler: () => {
    3.                     Debug.Log("User shared video!" + lastRecPath);
    4.                 }))
    5.                 payload.AddMedia(lastRecPath);
    The app shows the sharing option, but when I try to share with someone (be it Messenger, Whatsapp, or any other app), I receive an alert saying that "The file format is not supported".

    I get no errors when sharing an Image with "AddImage()".

    Thanks and keep up the great work!


    EDIT:

    So, I found that the problem is the Path. Is there a way to customize the path of a video or to get the last saved file name?

    Thanks!
     
    Last edited: Feb 17, 2020 at 9:45 PM
  20. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    You can't modify the path where NatCorder saves. You can save the path in a variable somewhere and refer back to it when you need it.
     
  21. Meneghetti

    Meneghetti

    Joined:
    Aug 26, 2014
    Posts:
    3
    Ok! Thanks! I've made it work, but it would be nice to be able to customize the file name ^^

    Cheers!
     
    Lanre likes this.
  22. Zed67

    Zed67

    Joined:
    Jun 1, 2018
    Posts:
    2
    I take it this isn't easy or possible with Natshare without a lot of custom work?
     
  23. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,853
    I wouldn't even know where to start with this, as I am completely unfamiliar with sharing directly to Instagram.
     
    Zed67 likes this.
unityunity