在 Xcode 3 中,应用程序被归档在 .apparchive 文件夹中。
在 Xcode 4 中,应用程序现在存档在 .xcarchive 包中。
有没有办法转换 .xcarchive 包中的 .apparchive 文件夹或使用 Xcode 4 打开 .apparchive 文件夹?
最佳答案
Dave Dunkin 的脚本效果很好,但在某些情况下我错过了图标和版本。下面是稍微调整过的脚本版本。 您需要安装 MacRuby,可在此处获取:http://www.macruby.org/downloads.html .
#!/System/Library/PrivateFrameworks/MacRuby.framework/Versions/A/usr/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'
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
}
关于xcode - 我们可以在 Xcode 4 中导入 .apparchive 包吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5060228/