Search code examples
swiftxcodecocoapodsmessagekit

Swift MessageKit issues


Here to show the image after installing MessageKit and the problems I am currently having with it. Maybe it's my pod file that is the problem but the MessageKit has issues in it. It looks like inside the MessageKit pod file some code needs to be updates from what it is showing me in Xcode after trying to build it. I have been cleaning and building my project. My project was working before installing MessageKit.

 pod 'Firebase'
 pod 'Firebase/Core'
 pod 'Firebase/Auth'
 pod 'Firebase/Storage'
 pod 'Firebase/Database'
 pod 'Firebase/Messaging'
 pod 'Firebase/Crash'
 pod 'GoogleSignIn'
 pod 'Bolts'
 pod 'FBSDKCoreKit'
 pod 'FBSDKLoginKit'
 pod 'FBSDKShareKit'
 pod 'TwitterKit'
 pod 'TwitterCore'
 pod 'SnapKit'
 pod 'Alamofire'
 pod 'SwiftyJSON'
 pod 'SDWebImage'
 pod 'UIActivityIndicator-for-SDWebImage'
 pod 'SVProgressHUD'
 pod 'SWRevealViewController'
 pod 'IQKeyboardManagerSwift'
 pod 'IGListKit'
 pod 'InstagramKit/UICKeyChainStore'
 pod 'InstagramKit'
 pod 'Reusable'
 pod 'OAuthSwift'
 pod 'AFNetworking'
 pod 'MBProgressHUD'
 pod 'Fabric'
 pod 'Crashlytics'
 pod 'OneSignal'
 pod 'BottomPopup'
 pod 'Kingfisher'
 pod 'MessageKit'
pod 'Firebase/Firestore'
post_install do |installer|
  installer.pods_project.targets.each do |target|
      if target.name == 'MessageKit'
          target.build_configurations.each do |config|
              config.build_settings['SWIFT_VERSION'] = '4.0'
          end
      end
   end
   end

end

target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignal'
end

enter image description here


Solution

  • You using the latest version of MessageKit which is 2.0. This version is only compatible with Swift 4.2

    So if you use Swift 4.2 remove this

    post_install do |installer|
      installer.pods_project.targets.each do |target|
          if target.name == 'MessageKit'
              target.build_configurations.each do |config|
                  config.build_settings['SWIFT_VERSION'] = '4.0'
              end
          end
       end
    end
    

    If use MessageKit with Swift 4.0 or 3.0 you need to use the version 1.0 of MessageKit. So your pod file would be like that

    pod 'MessageKit', '~> 1.0.0'
    

    I hope it solve your problem 😊