webex / webex-ios-sdk

iOS SDK for Webex
https://developer.webex.com/docs/sdks/ios
Other
25 stars 28 forks source link

Trying to extract this SDK to a react native package that can be reused #133

Open nicolasmelo1 opened 2 years ago

nicolasmelo1 commented 2 years ago

Bug Report

TL.DR.: When i compile my custom library it compiles, but when i try to use the library i've created on a real app, the app does not compile. And it really seems with WebexSDK package because with other packages/pods it works.

πŸ”Ž Search Terms

react native webex sdk, webex ios sdk as package, extract ios webex

πŸ•— Version & Regression Information

3.5.0

πŸ›  Tool Used

Macbook Pro 16GB M1

πŸ’» Code

I Have tried installing FBSDKCoreKit in the .podspec and it compiled and worked as expected. Then when i removed the FBSDKCoreKit and installed WebexSDK it gave me an error when running the code. This one is when installing WebexSDK library on the .podspec file https://youtu.be/NeP2NX6cjGA

require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_version = '2021.06.28.00-v2'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
  s.name         = "react-native-module"
  s.version      = package["version"]
  s.summary      = package["description"]
  s.homepage     = package["homepage"]
  s.license      = package["license"]
  s.authors      = package["author"]

  s.platforms    = { :ios => "13.0" }
  s.source       = { :git => "https://github.com/nicolasmelo1/react-native-module.git", :tag => "#{s.version}" }

  s.source_files = "ios/**/*.{h,m,mm,swift}"

  s.dependency "React-Core"
  s.dependency "WebexSDK"

  # Don't install the dependencies when we run `pod install` in the old architecture.
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
    s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
    s.pod_target_xcconfig    = {
        "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
        "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
    }

    s.dependency "React-Codegen"
    s.dependency "RCT-Folly", folly_version
    s.dependency "RCTRequired"
    s.dependency "RCTTypeSafety"
    s.dependency "ReactCommon/turbomodule/core"
  end
end

πŸ™ Actual behavior

I'm getting this error on the console:

 Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening ModuleExample.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ModuleExample.xcworkspace -configuration Debug -scheme ModuleExample -destination id=F364796E-5140-4CFD-ADE9-4CF794593068

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Planning
Analyze workspace

Create build description
Build description signature: 3fe56389d13fb695936aad1cd79bf6b2
Build description path: /Users/nicolasmelo/Library/Developer/Xcode/DerivedData/ModuleExample-cdzaxfvrbkxfyechcpvzbzeijktn/Build/Intermediates.noindex/XCBuildData/3fe56389d13fb695936aad1cd79bf6b2-desc.xcbuild

note: Build preparation complete
note: Building targets in dependency order
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the ModuleExample editor. (in target 'ModuleExample' from project 'ModuleExample')
/Users/nicolasmelo/lc-workspace/react-native-module/example/ios/ModuleExample.xcodeproj: error: The linked library 'libPods-ModuleExample.a' is missing one or more architectures required by this target: x86_64. (in target 'ModuleExample' from project 'ModuleExample')

2022-07-28 21:51:31.181 xcodebuild[28358:2026708] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 21:51:31.182 xcodebuild[28358:2026708] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **

It is strange because FBSDKCoreKit works and WebexSDK don't. It's important to say that on both cases i'm not even importing any of those SDKs on the code. I'm just adding WebexSDK to the podspec and compiling, there is no single code there.

What we are trying to do is create a library that we could reuse in our projects that have WebexSDK inside of it, it looks like WebexSDK cannot be compiled in a separated source from the app, it's meant to be used and compiled on the app. This is really bad for us because it means that if we want to use the SDK on two distinct apps we need to CTRL+C and CTRL+V the code. Which is definetly not ideal.

πŸ™‚ Expected behavior

I want to be able to compile WebexSDK without the app so i can extract the logic in a single library than can be reused by everyone in the team and the company. Right now the problem really seems on WebexSDK

Rudsriva commented 2 years ago

These frameworks are universal binaries so you'll need to either strip the Simulator build to get the required iOS framework or you can mark Validate Workspace to Yes to build successfully. Also you'll have to mark Enable Bitcode to No. These config you can find in Build Settings.

You would need to extract the binaries from these paths (ref. attached images) and link it in your new framework, then you should be able to use it.

Screenshot 2022-08-01 at 10 31 18 AM Screenshot 2022-08-01 at 10 31 47 AM Screenshot 2022-08-01 at 10 32 00 AM
nicolasmelo1 commented 2 years ago

Oh nice,

Thanks for your response, so, since i've read your message i've been trying to make it work but still without any success. One thing that i've noticed is that you compiled Test to a Test framework, can't i compile the source code to a static library?

it's still giving me this error:

Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening ModuleExample.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ModuleExample.xcworkspace -configuration Debug -scheme ModuleExample -destination id=F364796E-5140-4CFD-ADE9-4CF794593068

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Planning
Analyze workspace

Create build description
Build description signature: 9f60adfb6c57f9623891d49963e10757
Build description path: /Users/nicolasmelo/Library/Developer/Xcode/DerivedData/ModuleExample-cdzaxfvrbkxfyechcpvzbzeijktn/Build/Intermediates.noindex/XCBuildData/9f60adfb6c57f9623891d49963e10757-desc.xcbuild

note: Build preparation complete
note: Building targets in dependency order
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the ModuleExample editor. (in target 'ModuleExample' from project 'ModuleExample')
/Users/nicolasmelo/lc-workspace/react-native-module/example/ios/ModuleExample.xcodeproj: error: The linked library 'libPods-ModuleExample.a' is missing one or more architectures required by this target: x86_64. (in target 'ModuleExample' from project 'ModuleExample')

2022-08-01 10:08:23.829 xcodebuild[5150:835888] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-01 10:08:23.829 xcodebuild[5150:835888] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **

Captura de Tela 2022-08-01 aΜ€s 10 27 58 Captura de Tela 2022-08-01 aΜ€s 10 28 14 Captura de Tela 2022-08-01 aΜ€s 10 28 28

Here is the source code, it's really simple stuff just to test. Captura de Tela 2022-08-01 aΜ€s 10 29 43