Insta360Develop / CameraSDK-iOS

iOS SDK to control Insta360 cameras.
33 stars 5 forks source link

Runtime Errors and Warnings with INSCameraSDKSample-3.0.4_403 #40

Open shoaoki-arent opened 1 month ago

shoaoki-arent commented 1 month ago

I have integrated the Framework from what appears to be the latest SDK version, INSCameraSDKSample-3.0.4_403, into my project. Upon building, I encountered the following issues. Could these issues be specific to my environment?

  1. Runtime Log Warnings When including INSCameraSDK.xcframework and INSCoreMedia.framework in my project and setting both to Embed & Sign under Frameworks, Libraries, and Embedded Content, the following warning appears in the log:
objc[1700]: Class INSPBWindowCropInfoRoot is implemented in both /private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCameraSDK.framework/INSCameraSDK (0x1048645e0) and /private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCoreMedia.framework/INSCoreMedia (0x10e0a9300). One of the two will be used. Which one is undefined.
objc[1700]: Class INSPBWindowCropInfo is implemented in both /private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCameraSDK.framework/INSCameraSDK (0x104864608) and /private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCoreMedia.framework/INSCoreMedia (0x10e0a9328). One of the two will be used. Which one is undefined.
objc[1700]: Class INSPBOffsetStateRoot is implemented in both /private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCameraSDK.framework/INSCameraSDK (0x104864860) and /private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCoreMedia.framework/INSCoreMedia (0x10e0a9d50). One of the two will be used. Which one is undefined.

Previously, I used INSCameraSDK.xcframework and INSCoreMedia.framework from INSCameraSDK-SampleOC-2.9.43_388, and these warnings were not present. Also, INSCoreMedia is a framework, not an xcframework.

  1. Runtime Errors with xcframework Using INSCameraSDK.xcframework and INSCoreMedia.xcframework results in runtime errors with the following log:
    
    dyld[1622]: Library not loaded: @rpath/SSZipArchive.framework/SSZipArchive
    Referenced from: <6AAA3B66-16B8-35E0-892F-16377AF003A2> /private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCoreMedia.framework/INSCoreMedia
    Reason: tried: '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCoreMedia.framework/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/INSCameraSDK.framework/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/usr/lib/swift/SSZipArchive.framework/SSZipArchive' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/SSZipArchive.framework/SSZipArchive' (no such file), '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/usr/lib/swift/SSZipArchive.framework/SSZipArchive' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/SSZipArchive.framework/SSZipArchive' (no such file), '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/private/var/containers/Bundle/Application/{UUID}/{my app name}.app/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file), '/System/Library/Frameworks/SSZipArchive.framework/SSZipArchive' (no such file, not in dyld cache)

Both are set to Embed & Sign in Frameworks, Libraries, and Embedded Content, and both are using xcframework. As a preliminary fix, I tried adding SSZipArchive via pod install, which then indicated that NvEffectSdkCore was required.

Thank you for your assistance!
sssuourabh commented 2 weeks ago

Hi are you able to compile? I am not able to compile even.

Screenshot 2024-06-20 at 10 06 49 AM

@shoaoki-arent

sssuourabh commented 2 weeks ago

this is the output i am getting on Xcode 15.

A shell task (/usr/bin/xcrun lipo -create /Users/sourabhsingh/Library/Caches/org.carthage.CarthageKit/DerivedData/15.2_15C500b/Eureka/5.5.0/Build/Intermediates.noindex/ArchiveIntermediates/Eureka/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Eureka.framework/Eureka /Users/sourabhsingh/Library/Caches/org.carthage.CarthageKit/DerivedData/15.2_15C500b/Eureka/5.5.0/Build/Products/Release-iphonesimulator/Eureka.framework/Eureka -output /Users/sourabhsingh/Documents/NEWSDK/19june2024/INSCameraSDK/Carthage/Build/iOS/Eureka.framework/Eureka) failed with exit code 1: fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/sourabhsingh/Library/Caches/org.carthage.CarthageKit/DerivedData/15.2_15C500b/Eureka/5.5.0/Build/Intermediates.noindex/ArchiveIntermediates/Eureka/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Eureka.framework/Eureka and /Users/sourabhsingh/Library/Caches/org.carthage.CarthageKit/DerivedData/15.2_15C500b/Eureka/5.5.0/Build/Products/Release-iphonesimulator/Eureka.framework/Eureka have the same architectures (arm64) and can't be in the same fat output file

Building universal frameworks with common architectures is not possible. The device and simulator slices for "Eureka" both build for: arm64

sssuourabh commented 2 weeks ago

Please ignore my comments I am able to successfully run the example app.

shoaoki-arent commented 2 weeks ago

@sssuourabh Thank you for your comment. I found it difficult to run the sample app, so I decided not to proceed with it. I already have an older version of the INSCameraSDK embedded in my app, so I thought it would be sufficient to just replace it.

By the way, the sample app seems to be embedding a .framework instead of an .xcframework, so I don't think it provides any hints for solving the second point in my comment.

sssuourabh commented 2 weeks ago

@shoaoki-arent actually i figured out how to run the sample app. I haven't used in my app till now. if you need any help on running the sample app drop me a message. Thanks

shoaoki-arent commented 2 weeks ago

@sssuourabh Thank you very much.

When you have some time, could you please let me know what you did to get the sample app running? I'm sure it will be helpful to others as well.

Here’s what I have done so far: I tried fixing the path to the framework in the Frameworks directory (I couldn't find NSLogger.framework). image

After that, I'm encountering the following error with Eureka. It might be because I am using Xcode 15.2. However, this is the result of testing on a simulator, and the result may be different on a real device.

Compiled module was created by a different version of the compiler '5.9.0.128.108'; rebuild 'Eureka' and try again: /Users/{username}/Library/Developer/Xcode/DerivedData/INSCameraSDKSample-bluetooth-bnxikozjplyitngpcnkyktrpwnet/Index.noindex/Build/Products/Debug-iphoneos/Eureka.framework/Modules/Eureka.swiftmodule/arm64-apple-ios.swiftmodule
sssuourabh commented 2 weeks ago

Hi, Please follow these steps - In cartfile please update this - binary "https://ios-releases.insta360.com/INSCoreMedia.json" == 1.25.30 github "xmartlabs/Eureka" ~> 5.5

after that go to folder and run carthage update --use-xcframeworks

Screenshot 2024-06-21 at 11 10 08 AM

Just select the framework here and map to right address in right pane selecting the file. Go to build phase and check there is duplicate file addition of appdelegate and NSData+Hex remove them.

Screenshot 2024-06-21 at 11 12 15 AM

Ensure this in embed frameworks in build phase

ravilich86 commented 1 week ago

Hi @shoaoki-arent! I also have Xcode 15.2. As @sssuourabh suggested, you need to update the Cartfile. I also noticed that you have both INSCoreMedia.xcframework and INSCoreMedia.framework. You only need one of them. I removed NSLogger.framework entirely, and everything compiles for me.

Снимок экрана 2024-06-22 в 15 30 24 Снимок экрана 2024-06-22 в 15 30 32
shoaoki-arent commented 1 week ago

@sssuourabh @ravilich86 Thank you very much. I appreciate both of your assistance. I successfully managed to build on the actual device. I was struggling with errors, but after extracting the sample project again and starting over from the beginning, it worked out perfectly. Thank you for the wonderful tip!

shoaoki-arent commented 1 week ago

P.S. I understand that it is pointless since we are working with an real camera, but when trying to build on the simulator, I encountered an error in INSCameraSDK.xcframework indicating something like "no build for the simulator." Therefore, I have given up on running it on the simulator.

jessearmandse commented 1 week ago

@shoaoki-arent To have a universal framework, you'd need to build another simulator target. This can be an empty target in Xcode with sdk set to iphonesimulator. Then, you'd have to create a new xcframework from both architecture.

The resulting xcframework should contain these files:

Info.plist
ios-arm64
ios-arm64_x86_64-simulator

Although I wish Insta360 would just provide a proper INSCameraSDK.xcframework and INSCoreMedia.xcframework with universal architecture for us 😄

shoaoki-arent commented 1 week ago

@jessearmandse Thank you for the information. Does it actually work in the simulator, or is it solely intended to ensure a successful build?

jessearmandse commented 1 week ago

It's just to ensure a successful build. I guess you could also just link it on Apple Silicon machine, and bypass the simulator entirely.

sssuourabh commented 2 days ago

hi @jessearmandse can you please provide more info on this - https://github.com/Insta360Develop/CameraSDK-iOS/issues/40#issuecomment-2185851367 Need to create a fat binary to build on ios simulator also. @shoaoki-arent @kelvinhkw @capjason