# actionMeeting Unmute returns ZoomSDKError\_WrongUsage

**URL:** <https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990>\
**Category:** macOS\
**Created:** [May 25, 2020, 3:30pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990 "2020-05-25T15:30:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmiskiew](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dmiskiew/32/8026_2.png) [@dmiskiew](https://devforum.zoom.us/u/dmiskiew)\
**Post date:** [May 25, 2020, 3:30pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/1 "2020-05-25T15:30:34Z")

</div>

**Description**  
I copied following code from your sample:

```auto
let ret = meetingActionController?.actionMeeting(
  with: ActionMeetingCmd_UnMuteAudio, 
  userID: 0, 
  on: ScreenType_First
)

```

Unfortunately it doesn’t work - my user is still muted and the method returns `ZoomSDKError_WrongUsage` error.

Do you have a clue what can cause this problem?  
My app connects to a meeting without any problem.

**Which version?**  
v4.6.21666.0427

**Smartphone (please complete the following information):**

- Device: MacBook
- OS: macOS 10.15.2 (19C57)

**Additional context**  
The app is very simple. Just connecting using sdk and joining to meeting like:

```auto
let sdk: ZoomSDK = ZoomSDK.shared()
let meetingService = sdk.getMeetingService()
sdk.getSettingService()?.getAudioSetting()?.enableAutoJoinVoip(true)

meetingService?.joinMeeting(
    ZoomSDKUserType_APIUser, 
    toke4enfrocelogin: nil, 
    webinarToken: nil, 
    participantId: nil, 
    meetingNumber: "...", 
    displayName: "...", 
    password: "...", 
    isDirectShare: false, 
    sharedApp: 0, 
    isVideoOff: false, 
    isAuidoOff: false, 
    vanityID: nil
)

```

And then trying to call the actionMeeting, but no luck ☹

_ **UPDATE** _

We’ve migrated the code from Swift to ObjC and copied parts directly from the sample application. Still same error, and still no clues what this SDK is expecting:

```auto
#import "ViewController.h"

#define kZoomSDKDomain @"zoom.us"
#define kZoomSDKKey @"..."
#define kZoomSDKSecret @"..."
#define kSDKUserName @"Bobin"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    BOOL useCustomizedUI = NO;
    ZoomSDK* sdk = [ZoomSDK sharedSDK];
    
    NSString* domain = kZoomSDKDomain;
    NSString* key = kZoomSDKKey;
    NSString* secret = kZoomSDKSecret;
    
    [sdk initSDK:useCustomizedUI];
    [sdk setZoomDomain:domain];
    
    ZoomSDKError ret = [[sdk getAuthService] sdkAuth:key appSecret:secret];
}

- (IBAction)joinClicked:(id)sender {
    ZoomSDKMeetingService* meetingService = [[ZoomSDK sharedSDK] getMeetingService];
    
    NSString* userName = kSDKUserName;
    NSString* pwd = @"...";
    NSString* meetingNumber = @"...";
    
    ZoomSDKError ret = [meetingService joinMeeting:ZoomSDKUserType_APIUser
                                 toke4enfrocelogin:nil
                                      webinarToken:nil
                                     participantId:nil
                                     meetingNumber:meetingNumber
                                       displayName:userName
                                          password:pwd
                                     isDirectShare:NO
                                         sharedApp:0
                                        isVideoOff:NO
                                        isAuidoOff:NO
                                          vanityID:nil];
}

- (IBAction)unmuteClicked:(id)sender {
    ZoomSDKMeetingService* meetingService = [[ZoomSDK sharedSDK] getMeetingService];
    
    ZoomSDKError* result = [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_UnMuteAudio userID:0 onScreen:ScreenType_First];
    // result is ZoomSDKError_WrongUsage :-(((
}
@end

```

---

<div class="post-metadata">

**Author:** ![sam.decrock](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sam.decrock/32/8656_2.png) [@sam.decrock](https://devforum.zoom.us/u/sam.decrock)\
**Post date:** [May 25, 2020, 5:51pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/2 "2020-05-25T17:51:28Z")

</div>

Hi, you can get the user info of yourself by passing in `0` as the user id. However, it is my understanding that you need to pass in the real user id when using other functions like the unmute function.

---

<div class="post-metadata">

**Author:** ![dmiskiew](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dmiskiew/32/8026_2.png) [@dmiskiew](https://devforum.zoom.us/u/dmiskiew)\
**Post date:** [May 25, 2020, 5:57pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/3 "2020-05-25T17:57:43Z")

</div>

Hi @sam.decrock,

> [@sam.decrock](#):
>
> You can get the user info of yourself by passing in `0` as the user id. However, it is my understanding that you need to pass in the real user id

Yes, I’m trying to mute/unmute myself. I also tried another version of this code where I passed my user’s id, but still no luck ☹

I’m wondering why it works correctly in the sample code, but not in mine. I’m trying to make the example as simple as possible in order to figure it out but I can’t notice any difference…

Unfortunately the `ZoomSDKError_WrongUsage` alone does not give us, developers, a lot of feedback…

---

<div class="post-metadata">

**Author:** ![sam.decrock](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sam.decrock/32/8656_2.png) [@sam.decrock](https://devforum.zoom.us/u/sam.decrock)\
**Post date:** [May 25, 2020, 6:03pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/4 "2020-05-25T18:03:22Z")

</div>

The sample code is Objective C, right?  
Can you write up how you integrated it with Swift? I would love to work on a Swift version of my Windows integration.

Anyway, in C#, I have to mute myself with:

```
var me = participantsController.GetUserByUserID(0);
audioController.MuteAudio(me.GetUserID(), true);

```

Only passing in 2 arguments to a function of the audiocontroller. I don’t see what the third parameter is you are using…

---

<div class="post-metadata">

**Author:** ![sam.decrock](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sam.decrock/32/8656_2.png) [@sam.decrock](https://devforum.zoom.us/u/sam.decrock)\
**Post date:** [May 25, 2020, 6:05pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/5 "2020-05-25T18:05:30Z")

</div>

Btw, did you wait until you are in the meeting before sending the command?

Wait for `onMeetingStatusChange` to go to `ZoomSDKMeetingStatus_InMeeting` that is?

---

<div class="post-metadata">

**Author:** ![dmiskiew](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dmiskiew/32/8026_2.png) [@dmiskiew](https://devforum.zoom.us/u/dmiskiew)\
**Post date:** [May 25, 2020, 8:28pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/6 "2020-05-25T20:28:00Z")

</div>

> [@dmiskiew](#):
>
> Can you write up how you integrated it with Swift?

Hey @sam.decrock

I initially implemented it in Swift by creating brider h file in Xcode, but your comment suggested me, that maybe that’s the problem, so I recreated my code in ObjC as you can see in the updated original post - the code I pasted above is actually whole application so not much room to make mistake or overlook something…

Thanks for your suggestion, but I can’t use the participantsController in macOS version. I’m trying to mute the mic using exactly the same way as in the macOS sample code.

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [May 28, 2020, 4:59am UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/7 "2020-05-28T04:59:28Z")

</div>

@sam.decrock Thanks for helping out! 🙂

Hi @dmiskiew,

Thanks for the code snippet. If you would like to unmute yourself, you will need to pass a real userID, passing 0 will not work. And the `ActionMeetingCmd` needs to be called if and only if you are in the meeting.

Hope this helps. Thanks!

---

<div class="post-metadata">

**Author:** ![dmiskiew](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dmiskiew/32/8026_2.png) [@dmiskiew](https://devforum.zoom.us/u/dmiskiew)\
**Post date:** [May 29, 2020, 11:16pm UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/8 "2020-05-29T23:16:05Z")

</div>

Thanks for the answer @carson.zoom!  
As I mentioned couple posts earlier I tried with real user ID, but it didn’t help.  
But I finally figured it out by deleting line by line from the sample code.

The ZoomSDKError\_WrongUsage is returned if there’s no `ZoomSDKMeetingServiceDelegate`.  
Connecting the delegate with `onMeetingStatusChange`, `onWaitMeetingSessionKey` etc solved this and [other](https://devforum.zoom.us/t/getuserbyuserid-always-returns-nil/18971) problems.

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [June 17, 2020, 6:24am UTC](https://devforum.zoom.us/t/actionmeeting-unmute-returns-zoomsdkerror-wrongusage/18990/9 "2020-06-17T06:24:01Z")

</div>

Closed on June 17, 2020, 6:24am UTC


