如何访问组件的bundle资源

由的基础组件包含由图片,文件等资源。这页面资源文件用户可以获取到,不但使用组件的人可以找到这些资源,破解的iphone也能看到这些资源。所以若是机密文件就不安全,需要加密。那么怎么找到这些bundle的资源呢?
既然是资源文件,那么肯定在mainBundle下面。当你直接遍历这些文件,发现没有你要的Auth.bundle文件。但是意外发现了组件资源BITCrypto.bundle。那我使用下面的代码:

NSString *filePathObj = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"/BITCrypto.bundle/Auth.bundle"];
    filePathObj = [filePathObj stringByAppendingString:@"/auth_file"];

果然找到了我需要的Auth.bundle文件。简单言之就是:[[[NSBundle mainBundle] resourcePath] +组件资源+具体资源+资源文件名称

在这里插入图片描述
BITCrypto组件的BITCrypto.podspec文件如下:

Pod::Spec.new do |s|
  s.name             = 'BITCrypto'
  s.version          = '0.0.5'
  s.summary          = 'BITCrypto.'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC

  s.homepage         = 'http://www.baidu.com/'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'jiaguoshang' => 'jia12216@163.com' }
  s.source           = { :git => 'http://192.12.1.16:8688/bitinfo_tech_ios/BITCrypto.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '8.0'

  s.source_files = 'BITCrypto/Classes/**/*'
  
s.resource_bundles = {
    'BITCrypto' => ['BITCrypto/Classes/*.bundle']
  }

  # s.public_header_files = 'Pod/Classes/**/*.h'
   s.frameworks = 'UIKit', 'Foundation'
  # s.dependency 'AFNetworking', '~> 2.3'
end
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值