简体   繁体   中英

Appcelerator app crashing on Barcode.capture() line on iOS device

I need to read QR code in my app. So I am testing on the iOS device. I added module and I am using this example so far

enter link description here

App crashing on this line

Barcode.capture({
       animate: true,
       overlay: overlay,
       showCancel: false,
       showRectangle: false,
       keepOpen: true/*,
       acceptedFormats: [
           Barcode.FORMAT_QR_CODE
       ]*/
   });

I tried also without params like this Barcode.capture(); but still crashing.

SDK version is 6.0.1.GA

ti.barcode version is 1.9.1

Most likely if there is no log showing the crash then it is related to NSCameraUsageDescription key-value in tiapp.xml.

Add it like this:

<ios>
    <enable-launch-screen-storyboard>false</enable-launch-screen-storyboard>
    <plist>
        <dict>
            <key>UISupportedInterfaceOrientations~iphone</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
            </array>
            <key>UISupportedInterfaceOrientations~ipad</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
                <string>UIInterfaceOrientationPortraitUpsideDown</string>
            </array>
            <key>UIRequiresPersistentWiFi</key>
            <false/>
            <key>UIPrerenderedIcon</key>
            <false/>
            <key>UIStatusBarHidden</key>
            <false/>
            <key>UIStatusBarStyle</key>
            <string>UIStatusBarStyleLightContent</string>

            <key>NSCameraUsageDescription</key>
            <string>Can we use your camera?</string>

            <key>NSPhotoLibraryUsageDescription</key>
            <string>Can we save to your library?</string>
        </dict>
    </plist>
</ios>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM