Unity third-party sharing (WeChat) plug-in ShareSDK usage brief

Unity third-party sharing (WeChat) plug-in ShareSDK usage brief

WeChat share

Official Documentation: MobTech Integration Documentation-MobTech
Download Address: GitHub - MobClub/New-Unity-For-ShareSDK: New sample of ShareSDK for Unity, including ios and android.
Except for the problems I recorded myself, you can contact directly according to the official website Customer service, customer service is awesome! ! !
My project configuration:

  • Plugin: 1665733122796123261.24.unitypackage
  • Unity version: Unity 2021.3.11 f1c2

record of problems encountered

The method of using the SDK has been basically clearly written in the official documentation . Here are a few pitfalls I encountered.

  1. In the baseProjectTemplate.gradle file, in addition to the two points mentioned in the document, you need to add a sentence: mavenCentral(). As shown in the picture.
    baseProjectTemplate.gradle file

    Since jCenter officially announced that it will shut down the jCenter service on May 1, 2021, and gradually delete the data, in order to ensure the normal use of developers, WeChat Android openSDK has been migrated to Maven Central.

  2. The launcherTemplate.gradle file should be configured according to the document. The purpose of configuring this file is to display the corresponding option of which platform to share. You can refer to the file configuration of Android native side: ShareSDK-for-Android/MobSDK.gradle at master MobClub/ShareSDK-for-Android GitHub .

  3. demokey.keystore file, the file that comes with the SDK, the password is: 123456.

  4. Return the user privacy authorization result ( submitPolicyGrantResult): mobsdk.submitPolicyGrantResult(true);The first parameter passed in Booleanis type, truewhich means that the authorization is agreed, or falsethat the authorization is not agreed. Notice:This interface must be connected, otherwise it may result in the inability to use the related services provided by MobTech's SDKs. Note here that I have been debugging BUG for a long time because I didn't pay attention to this.

  5. In the official documentation, there are three interfaces below: sharing , authorization , and obtaining user information . Note that the three interfaces here have different functions and are not related to each other. At first, I thought that I needed to authorize the third party before sharing, but I finally found out the mistake after asking the official customer service. Pay attention to carefully review the document description .

  6. There are 4 different interfaces in the shared interface:

    • ShareContentWithActivityOnly on the iOS side, share through Apple's system pop-up window;
    • ShareContentIt is direct sharing, which is used in the project;
    • ShowPlatformListSharing via a selection menu for multi-platform sharing;
    • ShowShareContentEditorFirst pop up an edited interface (the various editing information Text, Title, etc. set before are used here) to share.
  7. ContentType.MiniProgramWhen the sharing type is set to , it is a small program sharing. For specific settings, please refer to the Demo.cs script that comes with the plug-in.

  8. The last question is more complicated, mainly on the iOS platform. First of all, shareSDKDevInfo.cs script, it is recommended to comment out the unnecessary platforms, and then uncomment when you need to add other platforms, as shown in the figure: After uncommenting, modify the corresponding in the
    ShareSDKDevInfo.cs script
    script Value (the corresponding value applied by the third-party platform), for example:
    insert image description here
    after the above operation is completed,Be sure to delete the ShareSDK component added to the GameObject in the scene and add it again, because the Plugins\iOS\ShareSDK\Editor\ShareSDK.mobpds configuration file in the iOS part of the plugin is not mentioned in the Unity documentation on the official website, but it is configured with third-party support files required by the iOS project. According to the source code , found that there is code about ShareSDK.mobpds file in the script ShareSDKConfigEditor.cs , this script is an editor script, and the function is called only when the script is deleted in the scene. That is, when the ShareSDK component is deleted, the ShareSDK.mobpds file will be edited according to the third-party information set in the code. In this way, when building the project, the corresponding third-party support files prefabricated in the plug-in will be packaged into the output project according to the ShareSDK.mobpds file. Those who are interested can view the source code.
    ShareSDKConfigEditor.cs
    OnDisable

  9. According to the above question, here is another record of my first question.
    When I use Git->push project, some files in the plug-in are automatically ignored by Git due to special suffixes, and then I manually add the file suffixes not to be ignored in the ignore file (.gitignore), when I finish Pushed all the plug-in files to Git. At this time, I did not pay attention to the ShareSDK.mobpds file mentioned in the above question, and directly packaged and tested ( iOS->TestFlight ) and found that Uploading could not be done (it could be uploaded, but after the official processing, the package disappeared ), it took a long time to find out that because the ShareSDK.mobpds file was not modified, it put all the third-party support files into the project, and some of the third parties need to set permissions in Xcode , because there is no permission , the package was " swallowed " by Apple officials, and there was no error reply ("too bad"). After setting, the package only used WeChat-related functions at that time, and there was no problem.

Link

official link

  1. https://github.com/MobClub/New-Unity-For-ShareSDK/tree/master
  2. https://www.mob.com/wiki/detailed?wiki=552&id=14
  3. https://github.com/MobClub/ShareSDK-for-Android/blob/master/SampleFresh/MobSDK.gradle
  4. https://www.mob.com/wiki/detailed?wiki=482&id=14

reference link

  1. https://blog.csdn.net/qq_36559726/article/details/79647914
  2. https://blog.csdn.net/a0_67/article/details/127058777
  3. https://blog.csdn.net/qq_43512996/article/details/120521603
  4. https://blog.csdn.net/beizijingzx/article/details/80798949
  5. https://blog.csdn.net/m0_37679113/article/details/80363642

Guess you like

Origin blog.csdn.net/f_957995490/article/details/130770749
Recommended