带有Hyperloop的Titanium中的第三方SDK

时间:2018-02-18 01:14:00

标签: ios sdk frameworks titanium appcelerator

我正在使用appcelerator钛7.0.2 ga sdk并构建一个ios应用程序。该应用程序已构建且功能正常,现在我需要导入第三方sdk才能连接到我的应用程序中的360相机。

在尝试使用360camera sdk时,我已经开始使用空白项目,下面的代码尝试直接在index.js控制器中。除了此代码尝试之外,该应用程序是干净的。所以没有其他事情可以阻碍。

在钛合金中,我在ipad ios os v11.2的开发环境中构建,但在8.x和9.x ios操作系统中也出现相同的错误。

使用本指南, https://docs.axway.com/bundle/Titanium_SDK_allOS_en/page/ios_hyperloop_programming_guide.html 我已成功导入相机的sdk。应用程序编译和编译输出确认编译器插入了类。输出是:

[INFO] :   [Hyperloop] Generating class INSCoreMedia/INS3DObject
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSButtonPressOptions
[INFO] :   [Hyperloop] Generating class INSCoreMedia/INSCamera
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraBTPeripheral
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraCalibrationVignetteGain
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraCalibrationVignetteLuma
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraCaptureStatus
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraDevice
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraDeviceSettings
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraExposureOptions
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraExposureParameter
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraFlatPanoOutput
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraImageStitcher
[INFO] :   [Hyperloop] Generating class INSCameraSDK/INSCameraManager

(简称截断)

我正在使用的框架的文档很少,但有一个自述文件说明了如何在swift中做。

import INSCameraSDK`

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    INSCameraManager.shared().setup()
    return true
}

[[INSCameraManager sharedManager] shutdown] //Call this when your app won't listen on Insta360 cameras any more.

在钛合金内部我试图做这样的事情:

var INSCameraSDK = require('INSCameraSDK/INSCameraSDK');   // this does not cause an error when I compile

var mgr = new INSCameraSDK.INSCameraManager(); // causes error  
//"undefined is not a constructor (evaluating 'new INSCameraSDK.INSCameraManager()')"; 

我也试过这个:

var Manager = require('INSCameraSDK/INSCameraManager');   // this does not cause an error when I compile
var mgr = new Manager();  // this cause an error
mgr.shared().setup(); // this never runs due to above exception
// the error is:
[ERROR] :  Cannot find class with name: INSCameraManager

此外,在此文档的链接上: https://docs.axway.com/bundle/Titanium_SDK_allOS_en/page/ios_hyperloop_programming_guide.html

它说:

  

函数指针

     

目前,最新版本目前不支持函数指针。

如何判断此INSCameraSDK是否使用函数指针?如果SDK没有使用它们,我在尝试实现它时遇到了什么错误。

以下是我尝试使用的相机sdk中的一些.h文件 - 我认为这可能会有所帮助。

  • 这是主要的INSCameraSDK.h文件

        #import 

    //! Project version number for INSCameraSDK.
    FOUNDATION_EXPORT double INSCameraSDKVersionNumber;
    
    //! Project version string for INSCameraSDK.
    FOUNDATION_EXPORT const unsigned char INSCameraSDKVersionString[];
    
    #import INSCameraSDK/INSCameraPhotoInfo.h>
    #import INSCameraSDK/INSCameraVideoInfo.h>
    
    #import INSCameraSDK/INSCameraError.h>
    #import INSCameraSDK/INSCameraManager.h>
    
    #import INSCameraSDK/NSNotification+INSCamera.h>
    #import INSCameraSDK/INSCameraCommandOptions.h>
    #import INSCameraSDK/INSCameraCommands.h>
    
    #import INSCameraSDK/INSCameraMedia.h>
    #import INSCameraSDK/INSCameraMediaSession.h>
    
    #import INSCameraSDK/INSThumbnailRender.h>
    #import INSCameraSDK/INSCameraPreviewPlayer.h>
    #import INSCameraSDK/INSCameraImageStitcher.h>
    
    #import INSCameraSDK/INSCameraFlatPanoOutput.h>
    #import INSCameraSDK/INSCameraScreenOutput.h>
    #import INSCameraSDK/INSCameraRawDataOutput.h>
    </pre>
    
  • 这是INSCameraManager.h文件

        //     // INSCameraManager.h     // INSCameraSDK     //

    #import <Foundation/Foundation.h> #import "INSCameraDevice.h" #import "INSCameraCommands.h" NS_ASSUME_NONNULL_BEGIN /// Posted on NSNotificationCenter.defaultCenter when an insta360 camera becomes connected and available for your application to use. extern NSString *const INSCameraDidConnectNotification; /// Posted on NSNotificationCenter.defaultCenter when an insta360 camera becomes disconnected. extern NSString *const INSCameraDidDisconnectNotification; typedef NS_ENUM(NSUInteger, INSCameraState) { /// an insta360 camera is found, but not connected, will not response INSCameraStateFound, /// the nano device is connected, app is able to send requests INSCameraStateConnected, /// connect failed INSCameraStateConnectFailed, /// default state, no insta360 camera is found INSCameraStateNoConnection, }; @interface INSCameraManager : NSObject /** * repsent the current connected nano camera, nil when no camera is connected. */ @property (nonatomic, nullable, readonly) INSCameraDevice *currentCamera; /** * all the commands that the camera will handle */ @property (nonatomic, nonnull, readonly) id<INSCameraAllUSBCommands> commandManager; /** * NotificationCenter used to receive notifications from camera. See also NSNotification+INSCamera.h */ @property (nonatomic, nonnull, readonly) NSNotificationCenter *notificationCenter; /** * the current connection state. */ @property (nonatomic, readonly) INSCameraState cameraState; /** * a singleton manager */ + (instancetype)sharedManager; /** * setup insta360 camera settings, must be called. */ - (void)setup; /** * must be called if you don't want to use insta360 camera any more. */ - (void)shutdown; @end NS_ASSUME_NONNULL_END </pre>

0 个答案:

没有答案