减小应用程序大小
Reduce app size
我正在使用 Xcode
版本 7.3.1。我的应用程序仅包含一个 UIWebView
和 2 个应用程序图标,项目文件夹大约占用 150 kb
存储空间。但是当在真实设备上测试它时(iPhone 5
),我从存储管理器的常规设置中检查它的大小,应用程序需要 16.2 mb?
iOS
Safari
只占用大约 2mb。为什么我的应用占用更多 storage
?
任何人都知道如何减少它的大小?
谢谢。
class ViewController: UIViewController, UIWebViewDelegate{
@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
override func viewWillAppear(animated: Bool) {
}
override func viewDidLoad() {
webView.delegate = self
let requestURL = NSURL(string: "https://www.whosebug.com/")
let request = NSURLRequest(URL: requestURL!)
activityIndicator.hidesWhenStopped = true
activityIndicator.startAnimating()
webView.loadRequest(request)
}
func webViewDidFinishLoad(webView: UIWebView) {
activityIndicator.stopAnimating()
}
}
很难说你的项目中有什么占用那么多space,如果你想检查你的应用程序,你可以生成一个 .ipa 文件,然后:
Simply change the extension of an .ipa file to .zip, then open it with
Finder to decompress it. Right-click on the unzipped .app bundle
and choose "Show Package Contents" to see the resources inside. This
can give you an idea of what is using the most space.
但请注意,开发中的应用程序比您将在 App Store 上发布的版本要大。它至少会减少 50-75% 的大小。
我正在使用 Xcode
版本 7.3.1。我的应用程序仅包含一个 UIWebView
和 2 个应用程序图标,项目文件夹大约占用 150 kb
存储空间。但是当在真实设备上测试它时(iPhone 5
),我从存储管理器的常规设置中检查它的大小,应用程序需要 16.2 mb?
iOS
Safari
只占用大约 2mb。为什么我的应用占用更多 storage
?
任何人都知道如何减少它的大小?
谢谢。
class ViewController: UIViewController, UIWebViewDelegate{
@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
override func viewWillAppear(animated: Bool) {
}
override func viewDidLoad() {
webView.delegate = self
let requestURL = NSURL(string: "https://www.whosebug.com/")
let request = NSURLRequest(URL: requestURL!)
activityIndicator.hidesWhenStopped = true
activityIndicator.startAnimating()
webView.loadRequest(request)
}
func webViewDidFinishLoad(webView: UIWebView) {
activityIndicator.stopAnimating()
}
}
很难说你的项目中有什么占用那么多space,如果你想检查你的应用程序,你可以生成一个 .ipa 文件,然后:
Simply change the extension of an .ipa file to .zip, then open it with Finder to decompress it. Right-click on the unzipped .app bundle and choose "Show Package Contents" to see the resources inside. This can give you an idea of what is using the most space.
但请注意,开发中的应用程序比您将在 App Store 上发布的版本要大。它至少会减少 50-75% 的大小。