Skip to content

Commit

Permalink
[msbuild] Validate that WatchOS2 App Extensions do not have watch-com…
Browse files Browse the repository at this point in the history
…panion set (#1091)
  • Loading branch information
jstedfast authored and rolfbjarne committed Nov 14, 2016
1 parent 9e11025 commit 8bd40db
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions msbuild/Xamarin.iOS.Tasks.Core/Tasks/ValidateAppBundleTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,23 @@ void ValidateWatchExtension (string path, string watchAppBundleIdentifier, strin
} else {
Log.LogError ("The Watch Extension '{0}' has an invalid Info.plist: the NSExtensionAttributes dictionary must contain a WKAppBundleIdentifier.", name);
}

PObject requiredDeviceCapabilities;

if (plist.TryGetValue ("UIRequiredDeviceCapabilities", out requiredDeviceCapabilities)) {
var requiredDeviceCapabilitiesDictionary = requiredDeviceCapabilities as PDictionary;
var requiredDeviceCapabilitiesArray = requiredDeviceCapabilities as PArray;

if (requiredDeviceCapabilitiesDictionary != null) {
PBoolean watchCompanion;

if (requiredDeviceCapabilitiesDictionary.TryGetValue ("watch-companion", out watchCompanion))
Log.LogError ("The WatchKit Extension '{0}' has an invalid Info.plist: the UIRequiredDeviceCapabilities dictionary should not contain the 'watch-companion' capability.", name);
} else if (requiredDeviceCapabilitiesArray != null) {
if (requiredDeviceCapabilitiesArray.OfType<PString> ().Any (x => x.Value == "watch-companion"))
Log.LogError ("The WatchKit Extension '{0}' has an invalid Info.plist: the UIRequiredDeviceCapabilities array should not contain the 'watch-companion' capability.", name);
}
}
}

void ValidateWatchOS1App (string path, string extensionName, string mainBundleIdentifier, string wkAppBundleIdentifier)
Expand Down

0 comments on commit 8bd40db

Please sign in to comment.