forcedotcom / SalesforceMobileSDK-iOS

iOS SDK for Salesforce
Other
538 stars 418 forks source link

I am trying to setup new ios project using forcehybrid command and while doing cordova prepare, I am getting below error #3721

Open hemantsumanmetacube opened 3 months ago

hemantsumanmetacube commented 3 months ago

Please fill out the following details:

  1. Version of Mobile SDK Used: 12.1
  2. Issue found in Native App or Hybrid App: Hybrid App
  3. OS Version: ios
  4. Steps: Setup new IOS Project using forcehybrid 12.1 and do cordova prepare
  5. Error Log:

The Swift pod SmartStore depends upon SQLCipher, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

wmathurin commented 3 months ago

After running forcehybrid create, the Podfile looks like

source 'https://cdn.cocoapods.org'
platform :ios, '16.0'

target 'TestApp' do
    project 'TestApp.xcodeproj'
    pod 'SalesforceHybridSDK', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Hybrid'
    pod 'MobileSync', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'SmartStore', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'FMDB/SQLCipher', :tag => '2.7.10', :git => 'https://github.com/ccgus/fmdb'
    pod 'SQLCipher', :tag => 'v4.5.6', :git => 'https://github.com/sqlcipher/sqlcipher'
    pod 'SalesforceSDKCore', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'SalesforceAnalytics', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'SalesforceSDKCommon', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'Cordova', :tag => '7.1.0', :git => 'https://github.com/apache/cordova-ios'
end

$dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if $dynamic_framework.include?(pod.name)
      def pod.build_type
        Pod::BuildType.dynamic_framework
      end
    end
  end
end
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.deployment_target.to_i < 9
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end
  end
end

However after doing cordova prepare

source 'https://cdn.cocoapods.org'
platform :ios, '16.0'

target 'TestApp' do
    project 'TestApp.xcodeproj'
    pod 'SalesforceHybridSDK', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Hybrid'
    pod 'MobileSync', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'SmartStore', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'FMDB/SQLCipher', :tag => '2.7.10', :git => 'https://github.com/ccgus/fmdb'
    pod 'SQLCipher', :tag => 'v4.5.6', :git => 'https://github.com/sqlcipher/sqlcipher'
    pod 'SalesforceSDKCore', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'SalesforceAnalytics', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'SalesforceSDKCommon', :tag => 'v12.0.0', :git => 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS'
    pod 'Cordova', :tag => '7.1.0', :git => 'https://github.com/apache/cordova-ios'
end

Looks like cordova prepare reverts changes done during plugin installation. If you add back the code following target ... end in you Podfile it should work. We will have a look on our side to see whether we are making changes through the right plugin hooks.

hemantsumanmetacube commented 2 months ago

Please let me know what changes do I need to do so that cordova prepare does not revert this changes.

wmathurin commented 2 months ago

Unfortunately we release a fix in a patch, you will have to re-apply the changes manually after every cordova prepare.