Top

Change avatar throw error

Comments

10 comments

  • Patrik Spisak

    Also calling function from MyUser class .setAvatar throw en error

     

    Terminating app due the uncaught exception 'NSInvalidArgumentException', reason: '-[__NSSingleEntryDictionaryI removeObjectForKey:]: unrecognized selector sent to instance
    0
    Comment actions Permalink
  • Le-Trong-Nghia HUYNH

    Hello Patrik,

    Yes the documentation is not updated. I will do it for next version, thanks for the feedback.

    As a quick answer, you can use `updateUserAvatar` and `deleteUserAvatar` from `ContactsManagerService`. However in latest SDK 2.4.0, these methods are synchronous, it means you need to dispatch in background if you don't want to block the current thread.

    In a future version, these methods are deprecated and will be replaced by ones with completion block to handle the response.

    Nghia

    0
    Comment actions Permalink
  • Patrik Spisak

    I have tried

     

    DispatchQueue.main.async {
    let error: NSErrorPointer = nil

    self.servicesManager?.contactstManagerService.deleteUserAvatar(error)
    }

    And does not work. Avatar was not deleted. Log say

    Update user avatar with empty data, abort
    0
    Comment actions Permalink
  • Le-Trong-Nghia HUYNH

    Hello Patrik Spisak

    It's kinda weird. If you have this log with the delete method, it means your user doesn't have a photo data yet (so not possible to delete). Maybe try to delete / update from Web or Rainbow iOS client first.

    For the update, do you see log starting by "Update avatar with url" ?

    And for result "Avatar update API result"

    Nghia

    0
    Comment actions Permalink
  • Patrik Spisak

    I can see avatar on Rainbow web-sandbox.openrainbow.com. Also I can delete from  there, but not with API call. 

    I have tried delete, then upload from API, that was successfull but when I tried to delete with API call I got same message

    Update user avatar with empty data, abort
    0
    Comment actions Permalink
  • Patrik Spisak

    Also API does not returning avatar data back, always return nil

     

       if servicesManager?.loginManager.isConnected ?? false {

                guard let personalProfile:Contact = servicesManager?.myUser.contact else {

                    return

                }           print(personalProfile.photoData)            

    }

    This is error log

    2022-06-09 14:46:20.456255+0200 DholRainbow[40047:3255113] [ContactsManagerService:3782] Could not get the avatar for contact Contact 0x282347720 : firstname 'P****k', lastname 'S****k', jid: b5842c98caf046b7a6f8a57a723b38f7@sandbox-all-in-one-rbx-prod-1.rainbow.sbg

    Seems there is problem with server. I thought that maybe that URL is blocking by company firewall, but I could not access even from mobile data.

    2022-06-09 14:46:20.409796+0200 DholRainbow[40047:3255113] [DownloadManager:581] performing request : GET https://cdn.sandbox.openrainbow.com/api/avatar/61e7fd2ccb6f357e7ae66b26?size=256&update=8c09577437c62050262a121cda31a172 sendsize 391

    ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://cdn.sandbox.openrainbow.com/api/avatar/61e7fd2ccb6f357e7ae66b26?size=256&update=8c09577437c62050262a121cda31a172, NSErrorFailingURLKey=https://cdn.sandbox.openrainbow.com/api/avatar/61e7fd2ccb6f357e7ae66b26?size=256&update=8c09577437c62050262a121cda31a172, _kCFStreamErrorDomainKey=12}
    0
    Comment actions Permalink
  • Le-Trong-Nghia HUYNH

    I have also tried on sandbox and have exact same issue than you.

    I have seen that the CDN server is used in the URL for sandbox to get avatar and it seems it's not working. So I need to fix it in the SDK. Sorry you don't have any workaround during that time.

    Thank you for this report and for all these information!

    1
    Comment actions Permalink
  • Le-Trong-Nghia HUYNH

    Hello Patrik,

    This issue should have been fixed with latest 2.4.1 version. Could you try and confirm?

    Thanks

    0
    Comment actions Permalink
  • Patrik Spisak

    Hi,

    Yes when I updated to 2.4.1 avatar update/remove working fine.

    0
    Comment actions Permalink
  • Le-Trong-Nghia HUYNH

    Thanks Patrik for the feedback!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Still can't find what you need?

  • Contact Us

    Do you have any question about Rainbow? Leave us a message to get more information.

    Contact
  • Ask the Community

    Do you need help? Ask your questions to the Community and get answers from other Rainbow users.

    Post message