守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 1834|回复: 0

IOS 读写keychain ANE

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52623
    钢镚
    1422

    开源英雄守望者

    发表于 2015-1-23 15:50:55 | 显示全部楼层 |阅读模式
    应用下载
    应用名称: ANE-Keychain
    支持64位:
    当前版本: 0.5
    运行平台: IOS 
    开发语言: ActionScript 3 Object-C 
    应用类别: ANE-C/C++
    应用简介: Air Native Extension for iOS to read and write data from and to the Keychain
    http://www.sticksports.com/mobile
    Air Native Extension for iOS – Keychain

    This is an Air native extension to read and write to the device’s keychain.

    This extension enables reading data from and writing data to the iOS device’s keychain. This extension stores data as strings.

    Version

    This is version 0.5 of this extension.

    Binary files

    The bin folder contains the compiled extension and the default swc, which can be used for local testing if required by your development environment (Flash Builder shouldn’t need it, but other IDEs may).

    Building

    Requirements – Adobe Air SDK 3.1 or later, XCode IDE

    • Add the FlashRuntimeExtensions.h file from the Adobe Air sdk to the ios/KeychainIosExtension folder in the project.
    • Create a copy of the build/example.build.config file in the build folder, calling it build.config and change the properties in this file to match your system.
      • A certificate is required by the build script. This may be a self-signed certificate created by Adobe Air. This should not be an Apple developer certificate.
    • Run the ant build script build.xml. This creates the native extension and default swc file inside the bin folder.
    The test project

    A simple test project is included for testing the extension. To build this air project

    • Set the access groups in the KeychainExtensionTest-app.xml file.
    • Set the test access group in the KeychainExtensionTest.as file.
    • Create a copy of the build/example.build.config file in the build folder, calling it build.config and change the properties in this file to match your system.
    • Run the ant build script test/build.xml. This creates the test ipa inside the test/bin folder.
    Using the extensionTo store a value in the keychain -
    1. Keychain.insertOrUpdate( key : String, value : String, accessGroup : String = null ) : int
    复制代码

    If the key already exists in the keychain, the value will be set to the new value. If the key doesn’t exist, the key will be created and the value set.

    The return value is an integer indicating success (KeychainErrors.success) or failure (any other value, see the KeychainErrors class for the possible errors).

    If accessGroup is not specified then the first accessGroup in your app’s entitlements is used, or the default accessGroup if none are specified.

    To store a value in the keychain only if it doesn’t exist already -
    1. Keychain.insert( key : String, value : String, accessGroup : String = null ) : int
    复制代码

    If the key already exists in the keychain, the insert will fail and the value for that key will not be altered.

    The return value is an integer indicating success (KeychainErrors.success) or failure (any other value, see the KeychainErrors class for the possible errors).

    If accessGroup is not specified then the first accessGroup in your app’s entitlements is used, or the default accessGroup if none are specified.

    To update a value in the keychain only if it does exist already -
    1. Keychain.update( key : String, value : String, accessGroup : String = null ) : int
    复制代码

    If the key already exists in the keychain, the value is updated. If the key does not already exist, the update fails.

    The return value is an integer indicating success (KeychainErrors.success) or failure (any other value, see the KeychainErrors class for the possible errors).

    If accessGroup is not specified then the first accessGroup in your app’s entitlements is used, or the default accessGroup if none are specified.

    To retrieve a value from the keychain -
    1. Keychain.get( key : String, accessGroup : String = null ) : String
    复制代码

    The return value is the value corresponding to the key in the keychain. If the key does not exist in the keychain, the returned value is null.

    If accessGroup is not specified then all accessGroups in your app’s entitlements are checked until a value is found.

    To delete a value from the keychain -
    1. Keychain.remove( key : String, accessGroup : String = null ) : int
    复制代码

    The return value is an integer indicating success (KeychainErrors.success) or failure (any other value, see the KeychainErrors class for the possible errors).

    If accessGroup is not specified then the value is deleted from all accessGroups in your app’s entitlements.

    Example code

    You can see the feature in action in the source code of the test project.

    Compiling your project

    This is an Air 3.1 extension. Specify the path to the iPhone SDK when compiling the project, using the functionality built in to your IDE or the platformsdk parameter if building with adt from the command line or a build script.

    DevelopersLicense

    Air Native Extension for iOS Keychain
    ……………………………….

    Author: Richard Lord
    Owner: Stick Sports Ltd.
    http://www.sticksports.com

    Copyright © 2011, Stick Sports Ltd.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    • Neither the name of Stick Sports Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.




    相关链接:


    https://github.com/StickSports/ANE-Keychain


    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2024-3-29 20:23 , Processed in 0.050771 second(s), 34 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表