Bug 2166 - ALAssetsLibrary appears to be incorrectly bound
Summary: ALAssetsLibrary appears to be incorrectly bound
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2011-11-23 02:43 UTC by Nic Wise
Modified: 2011-11-24 04:19 UTC (History)
3 users (show)

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

Hotfix (1.20 MB, application/zip)
2011-11-23 16:55 UTC, Rolf Bjarne Kvinge [MSFT]

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 Nic Wise 2011-11-23 02:43:50 UTC
Hi there



It appears that ALAssetsLibrary may be incorrectly bound. The apple docs state that it needs a CGImage (or NSData, but that one works), but the MT one takes a UIImage. Passing UIImage.CGImage fails (compiler error, no surprise), and passing a UIImage also fails saying:

Failed to encode image for saved photos

Should it be a CGImage in the binding?

Comment 1 Rolf Bjarne Kvinge [MSFT] 2011-11-23 09:04:09 UTC
You are of course correct.

I've fixed it, but it probably won't get into the next MonoTouch release (planned for next week).

Note that your current code will just start working when it's fixed (but you'll get an obsolete warning telling you to use the CGImage overload instead).
Comment 2 Nic Wise 2011-11-23 09:43:56 UTC
If it helps, my current code uses the NSData version (which is fine and accurate, no need to change)

The other one, while callable, always returns an error, so technically, it doesn't work at all.... I'd scrub it change it to CGImage :) (I guess deprecated is fine....)

Is there a way to extend the current one and add the new signature in, until the new version comes out? eg 

public class NewALAssetsLibrary : ALAssetsLibrary {
[binding here]  
public void Writeetcetc(CGImage etc);
Comment 3 Rolf Bjarne Kvinge [MSFT] 2011-11-23 16:55:58 UTC
Created attachment 942 [details]

Attached is a hotfix for this issue. Unzip the contents of this file into /Developer/MonoTouch/usr/lib/mono/2.1 and things should just work.

As a sidenote the fix did eventually make it for MT 5.0.3.
Comment 4 Nic Wise 2011-11-24 04:04:37 UTC
Thanks Rolf! :) Owen (who had the problem in the first place) us subbed to this bug, so he should be able to pick it up.

Comment 5 Owen Evans 2011-11-24 04:19:18 UTC
Great, tested the hotfix and works perfectly. 
Thanks for the very quick turn around.