Bug 44455 - [watchOS] possible missing NSAttributedString methods
Summary: [watchOS] possible missing NSAttributedString methods
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.WatchOS.dll ()
Version: XI 10.0 (iOS10)
Hardware: PC Mac OS
: --- normal
Target Milestone: (C9)
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2016-09-17 02:01 UTC by CraigD
Modified: 2016-09-27 19:51 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description CraigD 2016-09-17 02:01:49 UTC
TL;DR should this file (or parts of it) be included in WATCH build??


This code worked in the first release of WatchKit support (it is from the [WatchKitCatalog] sample):

var attrString = new NSAttributedString ("Ultralight Label", new UIStringAttributes {
    Font = UIFont.SystemFontOfSize (16f, UIFontWeight.UltraLight)
ultralightLabel.SetText (attrString);

which suggests a constructor `public NSAttributedString (string str, UIStringAttributes attributes)` existed.

However in Cycle 8/watchOS 3 preview, the above code doesn't compile. This suggests the constructor is missing. I'm not sure if it supposed to be there or not, but it appears to have been removed since an earlier version.


There is a simple workaround using the `.Dictionary` property:

var attr = new UIStringAttributes
    Font = UIFont.SystemFontOfSize(16f, UIFontWeight.UltraLight)
var attrString = new NSAttributedString("Ultralight Label", attr.Dictionary);

Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-09-22 15:30:33 UTC
PR: https://github.com/xamarin/xamarin-macios/pull/880
Comment 2 Sebastien Pouliot 2016-09-22 17:13:36 UTC
Merged in master 02818182f1d26b3c671af59290e9c9b7a9cc0d66
Comment 3 Saurabh 2016-09-27 10:11:58 UTC
I have checked this Issue with latest master build (XS, XI I am successfully able to build WatchKitCatalog: https://github.com/xamarin/ios-samples/blob/master/WatchKit/WatchKitCatalog/WatchkitExtension/LabelDetailController.cs#L19-L22 sample after changing deployment target to 3.0

Build output: https://gist.github.com/saurabh360/2b4a5e3a503d6f68b63151cb108abe38

Environment Info and logs: https://gist.github.com/saurabh360/2a5d19a6be564ee504162589eb946a8b

I will verify this Issue once fix will be merged into C9.
Comment 4 Manish Sinha 2016-09-27 19:51:26 UTC
Verifying C9 bugs in master is sufficient till C9 branches are made available.

Marking as verified