我们可以在Xcode 4中导入.apparchive包

Chr*_*mer 11 xcode archive ios

在Xcode 3中,应用程序存档在.apparchive文件夹中.

在Xcode 4中,应用程序现在存档在.xcarchive包中.

有没有办法在.xcarchive包中转换.apparchive文件夹或用Xcode 4打开.apparchive文件夹?

Joh*_*ool 11

Dave Dunkin的剧本很棒,但在某些情况下我错过了图标和版本.下面是稍微调整过的脚本版本.您需要安装MacRuby,可在此处获取:http://www.macruby.org/downloads.html.

#!/System/Library/PrivateFrameworks/MacRuby.framework/Versions/A/usr/bin/macrub??y

framework 'Cocoa'
require 'date'
require 'fileutils'

Dir.glob(Dir.home() + '/Library/Application Support/Developer/Shared/Archived Applications/*.apparchive').each { |apparchivePath|

  print "Found archive at #{apparchivePath}... "

  archiveInfo = NSDictionary.dictionaryWithContentsOfURL(NSURL.fileURLWithPath(apparchivePath + '/ArchiveInfo.plist')) 

  name = archiveInfo['XCUserProvidedName'] || archiveInfo['XCApplicationName']
  appFilename = archiveInfo['XCApplicationFilename']
  appPath = 'Applications/' + appFilename
  archiveDate = archiveInfo['XCArchivedDate']
  xcarchivePath = Dir.home() + '/Library/Developer/Xcode/Archives/' + archiveDate.strftime('%Y-%m-%d') + '/' + name + ' ' + archiveDate.strftime('%m-%d-%y %I.%M %p') + '.xcarchive'
  appVersion = archiveInfo['CFBundleVersion']
  iconPaths = archiveInfo['XCInfoPlist']['CFBundleIconFiles']
  if not iconPaths
    iconPaths = appPath + '/' + archiveInfo['XCInfoPlist']['CFBundleIconFile']
  else
    iconPaths = archiveInfo['XCInfoPlist']['CFBundleIconFiles'].collect { |f| appPath + '/' + f }
  end

  if File.directory?(xcarchivePath)
    puts 'skipping'
  else
    puts 'importing'
    FileUtils.mkdir_p(xcarchivePath)

    xcarchiveInfo = {
      'ApplicationProperties' => {
        'ApplicationPath' => appPath,
        'CFBundleIdentifier' => archiveInfo['CFBundleIdentifier'],
        'CFBundleShortVersionString' => appVersion,
        'IconPaths' => iconPaths
      },
      'ArchiveVersion' => 1,
      'CreationDate' => archiveDate,
      'Name' => name,
      'SchemeName' => archiveInfo['XCApplicationName']
    }
    if archiveInfo.has_key?('XCUserProvidedComment')
      xcarchiveInfo['Comment'] = archiveInfo['XCUserProvidedComment']
    end
    xcarchiveInfo.writeToURL(NSURL.fileURLWithPath(xcarchivePath + '/Info.plist'), atomically:false)

    FileUtils.mkdir_p(xcarchivePath + '/Products/Applications')
    FileUtils.cp_r(apparchivePath + '/' + appFilename, xcarchivePath + '/Products/Applications')
    FileUtils.mkdir_p(xcarchivePath + '/dSYMs')
    FileUtils.cp_r(apparchivePath + '/' + appFilename + '.dSYM', xcarchivePath + '/dSYMs')
  end
}
Run Code Online (Sandbox Code Playgroud)


Dav*_*kin 5

这是我写给我的MacRuby脚本.

#!/usr/local/bin/macruby

framework 'Cocoa'
require 'date'
require 'fileutils'

Dir.glob(Dir.home() + '/Library/Application Support/Developer/Shared/Archived Applications/*.apparchive').each { |apparchivePath|

  print "Found archive at #{apparchivePath}... "

  archiveInfo = NSDictionary.dictionaryWithContentsOfURL(NSURL.fileURLWithPath(apparchivePath + '/ArchiveInfo.plist')) 

  name = archiveInfo['XCUserProvidedName'] || archiveInfo['XCApplicationName']
  appFilename = archiveInfo['XCApplicationFilename']
  appPath = 'Applications/' + appFilename
  archiveDate = archiveInfo['XCArchivedDate']
  xcarchivePath = Dir.home() + '/Library/Developer/Xcode/Archives/' + archiveDate.strftime('%Y-%m-%d') + '/' + name + ' ' + archiveDate.strftime('%m-%d-%y %I.%M %p') + '.xcarchive'

  if File.directory?(xcarchivePath)
    puts 'skipping'
  else
    puts 'importing'
    FileUtils.mkdir_p(xcarchivePath)

    xcarchiveInfo = {
      'ApplicationProperties' => {
        'ApplicationPath' => appPath,
        'CFBundleIdentifier' => archiveInfo['CFBundleIdentifier'],
        'IconPaths' => archiveInfo['XCInfoPlist']['CFBundleIconFiles'].collect { |f| appPath + '/' + f }
      },
      'ArchiveVersion' => 1,
      'CreationDate' => archiveDate,
      'Name' => name,
      'SchemeName' => archiveInfo['XCApplicationName']
    }
    if archiveInfo.has_key?('XCUserProvidedComment')
      xcarchiveInfo['Comment'] = archiveInfo['XCUserProvidedComment']
    end
    xcarchiveInfo.writeToURL(NSURL.fileURLWithPath(xcarchivePath + '/Info.plist'), atomically:false)

    FileUtils.mkdir_p(xcarchivePath + '/Products/Applications')
    FileUtils.cp_r(apparchivePath + '/' + appFilename, xcarchivePath + '/Products/Applications')
    FileUtils.mkdir_p(xcarchivePath + '/dSYMs')
    FileUtils.cp_r(apparchivePath + '/' + appFilename + '.dSYM', xcarchivePath + '/dSYMs')
  end
}
Run Code Online (Sandbox Code Playgroud)