Skip to content

[Proposal] INSCameraSDK framework architecture and dependency #61

@jessearmand

Description

@jessearmand

As a background, I realized that on my integration of the iOS enterprise SDK version v1.8.2_build4, I can remove INSCoreMedia from the list of modules to be imported into the iOS application's Swift code.

However, INSCameraSDK has a dependency to INSCoreMedia. To elaborate more on this, please read the following:

INSCameraSDK v1.8.2-build4 has implicit dependencies on INSCoreMedia even for applications that only need basic camera control functionality. This results in:

  1. Linking Failures: The INSInstaCameraInput symbol is referenced in INSCameraSDK
  2. Forced Dependencies: All INSCameraSDK users must include or link INSCoreMedia framework that provides INSInstaCameraInput symbol
  3. No clear separation between core camera control and media playback features

Root Cause

The current framework structure tightly couples camera control with media processing:

  • INSCameraSDK references INSInstaCameraInput but doesn't implement it
  • INSCoreMedia.xcframework located in iOS_v1.8.2_build4/INSCameraSDKSample-bluetooth/Carthage/Build/INSCoreMedia.xcframework doesn't implement it
  • INSCoreMedia.xcframework located in iOS_v1.8.2_build4/INSCameraSDKSample-bluetooth/Frameworks/INSCoreMedia.xcframework contains the implementation

This creates a situation where developers must choose between:

  • Using the lite framework and getting linker errors
  • Using the full framework and shipping unnecessary media processing code

Technical Details

Symbol Analysis

  • Missing Symbol: _OBJC_CLASS_$_INSInstaCameraInput and _OBJC_METACLASS_$_INSInstaCameraInput
nm -gU INSCoreMedia.xcframework/ios-arm64/INSCoreMedia.framework/INSCoreMedia | grep INSInstaCameraInput
0000000004a3d518 S _OBJC_CLASS_$_INSInstaCameraInput
0000000004a3d4f0 S _OBJC_METACLASS_$_INSInstaCameraInput
  • Referenced In: INSCameraSDK.framework (undefined references)
  • Available In: Full INSCoreMedia.xcframework only
  • Missing From: INSCoreMedia.xcframework (lite version)

Here are the ways to determine if INSInstaCameraInput is loaded at runtime from INSCameraSDK.xcframework:

  1. Using nm (Symbol Table Analysis)
nm INSCameraSDK.xcframework/ios-arm64/INSCameraSDK.framework/INSCameraSDK | grep -i instacamerainput

U _OBJC_CLASS_$_INSInstaCameraInput
  • Shows U _OBJC_CLASS_$_INSInstaCameraInput (undefined symbol)
  • The "U" indicates it's an undefined reference, meaning it's expected to be resolved at runtime
  1. Using objdump
objdump -t INSCameraSDK.xcframework/ios-arm64/INSCameraSDK.framework/INSCameraSDK | grep -i instacamerainput

0000000000000000         *UND* _OBJC_CLASS_$_INSInstaCameraInput
  • Shows *UND* (undefined) symbol for _OBJC_CLASS_$_INSInstaCameraInput
  1. Using strings
strings INSCameraSDK.xcframework/ios-arm64/INSCameraSDK.framework/INSCameraSDK | grep -i instacamerainput

T@"INSInstaCameraInput",&,N,V_input
@"INSInstaCameraInput"
  • Shows string references including @"INSInstaCameraInput"
  1. Using otool for Dependencies
otool -L INSCameraSDK.xcframework/ios-arm64/INSCameraSDK.framework/INSCameraSDK | grep -i inscoremedia

@rpath/INSCoreMedia.framework/INSCoreMedia (compatibility version 1.0.0, current version 1.0.0)
  • Shows INSCoreMedia.framework as a dependency where INSInstaCameraInput likely resides

Affected Components

The following 10 headers in INSCameraSDK create hard dependencies on INSCoreMedia:

Player/Render/Session Layer:

  • INSCameraPreviewPlayer.h, INSCameraSessionPlayer.h, INSCameraPlayerRender.h
  • INSCameraPlayerRenderView.h, INSCameraPlayerRenderSession.h, INSOffsetCalculator+Convert.h

Processing/Stabilization Layer:

  • INSCameraFlatPanoOutput.h, INSCameraStabilizer.h, INSDisplayInfo.h, INSCameraMediaSession.h

Reproduction Steps

  1. Create new iOS project
  2. Add INSCameraSDK.xcframework and INSCoreMedia.xcframework from iOS_v1.8.2_build4/INSCameraSDKSample-bluetooth/Carthage/Build/INSCoreMedia.xcframework
  3. Use any live session features (e.g., INSInstaCameraSession) or simply launch the app with INSCameraSDK imported
  4. Build for arm64 → Dynamic Linker Error: Symbol not found: _OBJC_CLASS_$_INSInstaCameraInput
dyld[77717]: Symbol not found: _OBJC_CLASS_$_INSInstaCameraInput
  Referenced from: <5E604B2F-FCF9-34B7-9D84-8A8E8E7D8CC9> /private/var/folders/6j/h78c119x50q2q347jj98w9yw0000gp/X/8ADC0B3D-5480-56A9-8586-F2955355A8A6/d/Wrapper/SCEApp.app/Frameworks/INSCameraSDK.framework/INSCameraSDK
  Expected in:     <A24D0769-FB1B-3D7D-9598-1BC7E33B21E5> /private/var/folders/6j/h78c119x50q2q347jj98w9yw0000gp/X/8ADC0B3D-5480-56A9-8586-F2955355A8A6/d/Wrapper/SCEApp.app/Frameworks/INSCoreMedia.framework/INSCoreMedia

Current State Impact

Developer Experience Issues

  • Unclear Dependencies: Inconsistent documentation explaining implicit dependencies to INSCoreMedia
  • Binary Size: Apps requiring only camera control forced to ship large media processing framework
  • Build Complexity: Developers must manually manage framework variants

INSInstaCameraInput Usage References

The problematic symbol is referenced in:

  • INSCameraPlayerRenderSession.h:19 - parameter in method signature
  • INSInstaCameraSession.h:10,49,57 - import, property, and initializer parameter
  • Multiple header files referencing the class definition

Proposed Solution: Framework Architecture Refactor

The following is only a suggestion or proposal, the framework name such as INSCameraSDKCore or INSCameraSDKPlayer can be replaced based on a suitable naming convention.

1. Framework Split Strategy

Current Structure:

INSCameraSDK.framework → INSCoreMedia.framework, INSCameraServiceSDK.framework (forced dependency)

Proposed Structure:

INSCameraSDKCore.framework     # Camera control only, no INSCoreMedia dependency
INSCameraSDKPlayer.framework   # Media playback, depends on INSCoreMedia
INSCameraServiceSDK.framework (it should not depend on the other frameworks)

2. Component Separation

INSCameraSDKCore (lightweight):

  • Camera connection and control
  • Bluetooth pairing and commands
  • Device activation and management
  • Basic stitching and timelapse
  • No media processing dependencies

INSCameraSDKPlayer (media-focused):

  • Preview and session players
  • Real-time stabilization
  • Flat panorama output
  • Live session management
  • Depends on full INSCoreMedia

3. INSCoreMedia Variants

If they can be separated, provide clear framework variants:

  • INSCoreMedia-Lite.xcframework: Offline rendering only (~8MB)
  • INSCoreMedia.xcframework: Live sessions + offline (~20MB)

4. Benefits

For Developers:

  • Smaller Apps: Reduction in framework size for camera-only apps
  • Clearer Dependencies: Explicit choice between core vs full functionality
  • Better Documentation: Clear separation of concerns

For Insta360:

  • Reduced Support: Fewer dependency-related issues
  • Faster Development: Independent evolution of camera and media layers
  • Better Testing: Isolated testing of components

Implementation Suggestion

Analysis & Planning

  • Audit all INSCoreMedia dependencies in INSCameraSDK
  • Define public APIs for Core vs Player frameworks
  • Create module map specifications

Core Framework Creation

  • Extract camera control code to INSCameraSDKCore
  • Remove INSCoreMedia dependencies from INSCameraSDKCore
  • Implement optional/weak linking patterns for frameworks that are optional

Player Framework Creation

  • Move media processing code to INSCameraSDKPlayer
  • Ensure proper INSCoreMedia integration
  • Add re-export module maps

Distribution & Documentation

  • Create xcframework binaries for arm64 architecture (iphonesimulator), x86_64 is no longer needed
  • Update documentation and migration guides

Environment

  • SDK Version: 1.8.2-build4
  • Platform: iOS arm64
  • Xcode: 16.4+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions