I'm writing a Swift chat app using JSQMessageViewController as well as PubNub. I have no problem getting text messages in real time and display them correctly. But I'm stuck on retrieving image messages, I can send images without any problems but when the receiver gets the image it becomes a NSCFString data. The output of print(message.data.message) in PubNub's didReceiveMessage function is :<UIImage: 0x155d52020>, {256, 342}, And the output of print(message.data) is : { message = "<UIImage: 0x155d52020>, {256, 342}"; subscribedChannel = aUpVlGKxjR; timetoken = 14497691787509050;}
Does anyone know how to convert this data to UIImage?
Having trouble retrieving images from PubNub didReceiveMessage Function in Swift App
346 Views Asked by jackson At
1
There are 1 best solutions below
Related Questions in IOS
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Is the transactionReceipt data present in dataWithContentsOfURL?
- UIWebView Screen Fitting Issue
- ZXingObjC encoding issues
- iOS: None of the valid provisioning profiles allowed the specific entitlements
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Slow performance on ipad erasing image
- Swift code with multiple NSDateFormatter - optimization
- iOS 8.3 Safari crashes on input type=file
- TTTTimeIntervalFormatter always returns strings in English
- How do I add multiple in app purchases in Swift Spritekit?
- Setup code for xibs in iOS. -awakFromNb:
- iOS Voice Over only reads out the title of any alert views
Related Questions in SWIFT
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Swift code with multiple NSDateFormatter - optimization
- How do I add multiple in app purchases in Swift Spritekit?
- cellForRowAtIndexPath and prepareForSegue return different label colors
- Getting this message in my console in xcode "Ignoring restoreCompletedTransactionsWithApplicationUsername: because already restoring transactions"?
- Change background of an Accessory View in a UITableViewCell
- fade in an bounce animation subview
- Create a PFObject and PFRelation after PFUser Sign Up
- Swift 2 - Pattern matching in "if"
- How do I give inputs through NSURL
- How do I add custom cells to TableView in Swift?
- UIWebView not loading URL in simulator
- Compiler complains that 'Expression resolved to unused function' when removing index in array of functions
- Cast from 'Int?' to unrelated type 'NSNumber' always fails
Related Questions in UIIMAGE
- Rotating CIImage around a point
- Swift: Display image from UIImage array in table view
- Trouble in uploading profile image to parse.com during signUpInBackgroundWithBlock
- Slight delay before image blurred
- Get name of img from for loop
- How to store PNG images for profile pictures on Parse.com?
- Allow user to change image to one from their gallery
- Swift: UIImages appearing out of order in table view
- Changing the size of the UIImage
- Loading multiple saved images in app slows it down
- Can't load image with UIImage or NSData
- iOS AVAssetWriter Video Height "Squished" when exported to from UIImages
- How to add an image when a row is selected and then remove it when it is deselected in UITableView in SWIFT
- How to add UIImage object into NSMutableArray in iOS
- WatchKit extension: how to read data from host iOS app?
Related Questions in PUBNUB
- Pubnub getting duplicated message when changing channel
- pubnub, how to identify the sender?
- Android pubnub chat using parse giving incorrect authentication key error
- How do I turn off pub nub logging on iOS in swift?
- Can pubnub be integrated with rails devise for authentication
- Pubnub chat set up for rails application
- Does pubnub affect the concurrency of my rails application?
- Can't get a simple ruby Example working for pubnub
- PUBNUB here_now returning wrong channel list
- Pass image between canvas with Webrtc
- Cross-platform text, image, video Chat for Android, iOS and Web using Firebase/Parse/PubNub
- Pubnub chat application with storage
- Can not resolve removeAllPushNotificationsForDeviceRegistrationId() in PubNub.java
- How to add user library as dependency to play framework?
- Missing PubNub callback
Related Questions in NSCFSTRING
- Spotify SPTAuth canHandleURL is crashing with NSInvalidArgumentException
- Range or index out of bounds (App is crashing)
- NSCFConstantString size trying to set an Image
- NSMutableArray changes to NSCFString
- Swift Userdefaults converting String to __NSCFString
- iphone sdk: NSCFString does not match with value
- Getting an error when using replaceOccuranceOfString function
- NSMutableDictionary converted into __ NSCFString
- __NSCFString setHidden: unrecognized selector sent to instance
- NSString or NSCFString in xcode?
- Having trouble retrieving images from PubNub didReceiveMessage Function in Swift App
- JSONKit returning unwanted NSCFString rather than NSDictionary
- __CFNSString to NSString loses special chars
- Getting NSCFString objectAtIndexedSubscript with NSLog in cellForRowAtIndexPath
- __NSCFString object not being output in NSLog statement
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You need to convert UIImage to base64 encoding and then send to pubnub message and then decode base64 into UIImage.
Encode:
Decode:
Reference: Convert between UIImage and Base64 string