I have tried everything suggested from the post by DTS engineer, but I still can't get it working.
I am now getting something slightly different:
Command CodeSign failed with a nonzero exit code
Post
Replies
Boosts
Views
Activity
Thanks for your reply, but unfortunately, it doesn't seem to do the job.
The error in full that I am getting this evening is:
CodeSign /Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app (in target 'MyApp' from project 'MyApp')
cd /Users/user/Documents/GitHub/MyApp/MyApp
Signing Identity: "Apple Development: My Name (REDACTED)"
Provisioning Profile: "iOS Team Provisioning Profile: REDACTED"
(REDACTED)
/usr/bin/codesign --force --sign {REDACTED} --entitlements /Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.app.xcent --generate-entitlement-der /Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
/Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
When I run:
xattr -lr MyApp.app
I get the following output:
MyApp.app/Base.lproj/Main.storyboardc: com.apple.FinderInfo:
MyApp.app/Base.lproj/Main.storyboardc: com.apple.fileprovider.fpfs#P:
MyApp.app/Base.lproj/LaunchScreen.storyboardc: com.apple.FinderInfo:
MyApp.app/Base.lproj/LaunchScreen.storyboardc: com.apple.fileprovider.fpfs#P:
MyApp.app: com.apple.FinderInfo:
MyApp.app: com.apple.fileprovider.fpfs#P:
When I run:
xattr -cr MyApp.app
It does something, but I am still presented with the same error.
Now to complicate things, even though I get the same error, the Applications directory isn't being generated.
I can't understand why there would be forks in the StoryBoards, I do have some RSS feeds and links out.
I have a feeling this is what is working:
import UIKit
import WebKit
import CoreLocation
class ViewController: UIViewController, WKNavigationDelegate {
var webView: WKWebView!
override func loadView() {
webView = WKWebView()
view = webView
let url = URL(string: "https://domain.com")!
webView.load(URLRequest(url: url))
webView.allowsBackForwardNavigationGestures = true
webView.navigationDelegate = self
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if navigationAction.navigationType == .linkActivated {
if let url = navigationAction.request.url,
let host = url.host, host.hasPrefix("domain.com") !=
UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
decisionHandler(.cancel)
} else {
// Open in web view
decisionHandler(.allow)
}
} else {
// other navigation type, such as reload, back or forward buttons
decisionHandler(.allow)
}
}
}
This seems to be working as I would expect.
OK, I have sussed it.
First, in the info.plist I added:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
Then in the ViewController, it now looks like:
import UIKit
import WebKit
import CoreLocation
class ViewController: UIViewController, WKNavigationDelegate {
var webView: WKWebView!
override func loadView() {
webView = WKWebView()
webView.navigationDelegate = self
view = webView
let url = URL(string: "https://domain.com")!
webView.load(URLRequest(url: url))
webView.allowsBackForwardNavigationGestures = true
webView.navigationDelegate = self
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if navigationAction.navigationType == .linkActivated {
if let url = navigationAction.request.url,
UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
decisionHandler(.cancel)
} else {
// Open in web view
decisionHandler(.allow)
}
} else {
// other navigation type, such as reload, back or forward buttons
decisionHandler(.allow)
}
}
}
And so far, it works.