Error Domain=PlugInKit Code=13 "query cancelled" when using picked image with UIImagePickerController - uiimagepickercontroller

I am trying to use an image picked using the standard UIImagePickerController in iOS 11. No matter how hard I try it just keeps showing this error:
errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled
I can actually pass the UIImage to the setter method, I can see the image in the inspector, but when I set it as a background image of a UIButton, it's just a plain black colour and when the UIImagePickerController dismisses, I get the error above.
I did request use the PHPhotoLibrary.requestAuthorization and YES I have Read and Write access to Photos.
Any ideas?

Perhaps you did not use UIImagePickerControllerOriginalImage or UIImagePickerControllerEditedImage but rather another non-image editing option for UIImagePickerController.
I experienced the same/similar error.
The app ran yet the image showed as black. The line I used to assign the image originally looked like this:
let pickedImage = info[UIImagePickerControllerPHAsset] as? UIImage
and was resolved by changing the line to this:
let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage

I just had this error what worked from me is adding the uinavigationcontrollerdelegate to my file and then declaring the uiimagepickercontroller as self in the view did load.
example
class notesview: UIViewController,UIImagePickerControllerDelegate, UINavigationControllerDelegate{
var imagePicker = UIImagePickerController()
viewdidload(){
imagepicker.delegate = self
}
}

Related

import a google static map directly in fpdf

I wanted to place a google static map in a pdffile generated by using the fpdf extension.
and used code to make a tempfile first. Using this code. However I run into an error ('can't open image file').
// define the mapurl
$fullURL = 'http://maps.googleapis.com/maps/api/staticmap?center=Amsterdam&z=14&size=100x100&sensor=false';
// create a tempfile
$tempF = tmpfile();
fwrite($tempF, file_get_contents($fullURL));
//Rewind to the start of file
rewind($tempF);
// place the image in the pdf.
if (!empty($tempF)) {
$this->Image($tempF,$start_x, $this->GetY(),0,100);
}
fclose($tempF); // remove the tempfile
Note: OP's own answer extracted from the question.
Then I found out it can be done much easier... I don't need to use a tempfile. If I put the url in the image variable and give a format the thing works in two lines.. I don't use the height and width parameters in fpdf because they stretch the image into a unreadable form.
$fullURL = "http://maps.googleapis.com/maps/api/staticmap?center=". \
$row-Google_coor."&zoom=10&size=2200x200\
&markers=color:blue%7Clabel:D%7C".$row->Google_coor;
$this->Image($fullURL,$start_x, $this->GetY(),0,0,"PNG");
Saddly when using this function sometimes the program returns an error. The image could not be found. But when I put the url string in the browser the image shows up fine. Hopefully this is also a minor fallback.
Lets see if I find a solution on the google apis site https://developers.google.com/maps/documentation/staticmaps/?csw=1
For what it is worth I had this problem as well, I found that my server had an outgoing connections manager, this would automatically block the request, I had to add the ip, once this was done it worked fine.
I had a problem similiar to the OP's. I was getting an error when using FPDF and trying to get the static map image from Google Maps and into my PDF. I was getting "FPDF error: Missing or incorrect image file". What I did is to register in the Google Developer Console and get an API Key, just like they say in the documentation
Hope this helps.
You can download the image and use it with fpdf
$url ="https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&key=".$googleApiKey;
$img = __DIR__.'/img/map.png';
file_put_contents($img, file_get_contents($url));
$pdf->Image($img,null,null,170);
Hope that this will be helpful

a generic error occurred in gdi+. while saving an image

Dear Expert i am getting an error while saving an image the code is as follows
ClsImageManager objImgManager = new ClsImageManager();
Bitmap ImageBitmap = objImgManager.GetBitmapFromBytes(ImageData);
Response.ContentType = "image/tiff";
ImageBitmap.Save(Response.OutputStream, ImageFormat.Tiff);
ImageBitmap.Dispose();
Response.End();
when i used Image.format.jpeg the code is working good but when i changes it to ImageFormat.Tiff then i am getting an error a generic error occurred in gdi+.
You should note that GDI/GDI+ (System.Drawing namespace) is not officially supported in ASP.NET - see "Caution" in http://msdn.microsoft.com/en-us/library/system.drawing.aspx.
WIC is supposed to be used instead GDI+ (see http://weblogs.asp.net/bleroy/archive/2009/12/10/resizing-images-from-the-server-using-wpf-wic-instead-of-gdi.aspx)
Said that, many had successfully use GDI+ in ASP.NET. Most probably, you should attempt saving image into memory stream (or on file) and then writing saved image into the response. See this link for details: http://www.west-wind.com/weblog/posts/2006/Oct/19/Common-Problems-with-rendering-Bitmaps-into-ASPNET-OutputStream
Another work-around can be related to user account. Apparently, GDI/GDI+ is bound to device context (screen, printer etc) and they may not be available under service accounts. So you may try running your ASP.NET code on some normal user account if that helps or not.
You may need to try explicitly encoding the image save.
Have a look at the code example at the bottom of this MSDN documentation on Image.Save
Image.Save Method (String, ImageCodecInfo, EncoderParameters)
The same actions can be applied to your save.
However, it could also possibly be that your objImgManager is disposing of the buffer where the image is stored before you can save it.
Bitmap ImageBitmap = objImgManager.GetBitmapFromBytes(ImageData);
You can get around this by creating a copy of the image by doing this:
Bitmap ImageBitmap = new Bitmap(objImgManager.GetBitmapFromBytes(ImageData));

How to handle error code -43 from NSOSStatusErrorDomain when initializing AVAudioPlayer Object?

I observed strange behavior while working with AVAudioPlayer
Following is the code:
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL fileURLWithPath:[NSString stringWithFormat:#"%#",fileName]] error: &error];
In this, I downloaded the file from server and stored in application's Cache directory.
I am getting following error:
Error in playing =
Domain = NSOSStatusErrorDomain
Code = -43
Description = Error Domain=NSOSStatusErrorDomain Code=-43 "The operation couldn’t be completed. (OSStatus error -43.)"
I also verified that file is present at that location.
Everytime I restart my application, I was getting same error for song play.
After some time, when I tried to run same code, my player just works fine without any error.
Can anyone tell me how to handle this error?
Also, Can anyone explain me what was the problem?
AVAudioPlayer does not support streaming via HTTP. Try using AVPlayer instead.
I had the same error with this code, even though I could verify that the songCacheURL was valid and that the file was available:
self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:songCacheURL error:&error];
I was able to fix the issue by loading the file first into an NSData element and then using that to initialize the AVAudioPlayer instead, like so:
NSData *songFile = [[NSData alloc] initWithContentsOfURL:songCacheURL options:NSDataReadingMappedIfSafe error:&error1 ];
self.audioPlayer = [[AVAudioPlayer alloc] initWithData:songFile error:&error2];
I hope that helps someone else.
Robin
I had a similar issue. As it turns out, I was initializing the url with just the filename and omitting the bundle resources path. Your url init should look something like:
NSURL *url= [NSBundle URLForResource: #"my_sound" withExtension:#"mp3"];
I had the same error and it appeared to be that the URL was nil.
Try to check if your URL object is != nil.
Maybe your path is wrong.
I had a similar issue with AVAudioPlayer while using local-file based URL. As has been established, the trouble was with an incorrect file name, I just didn't notice a leading whitespace in its name. So first of all just check your URLs attentively.
I had a similar issue, the problem wound up being that my mp4 file target membership check box was unchecked, once I checked it, the file played perfectly.
I had a same problem and I solved it now. The problem was in name of mp3 file. In code was file name "Yes.MP3" but name of file is "Yes.mp3". When I running application in simulator everything is ok, because (I don't know why) simulator isn't case sensitive. When you are running the same code on device this error will occurred in this case.

How to define content type when an loading image in as3 flex project?

in flashCS3.app i think all you have to do is:
var thumb_url = my_images[i].#URL;
var thumb_loader = new Loader();
thumb_loader.load(new URLRequest(thumb_url));
but i am using flex + as3project.
how can i translate?
do i need some sort of bitmapdata class or is there a more transparent translation?
the error i get is something along the lines of "content type undefined".
thanks,
jml
I guess, it'd help a lot, if you could provide a URL where it doesn't work ...
you cannot define the content type ... the content type should be defined by the server, in a HTTP response header ... however flash player usually ignores it and looks at the starting sequence to determine the loaded content type ...
as just_a_dude mentioned, the error you get, appears, when the file type is not supported ... what kind of image are you loading?
it looks like it was as simple as a bunk link.
sorry for the noise; i had a mal-formatted PHP string that was calling an image up.

Error: is not a valid virtual path

I used something like
Dim i As String
i = Server.MapPath("~/photos/") + fileName
Only once in a project that was working and online, on the offline version, when I run it on my machine, its working, no errors, I uploaded it, it gave me an error like:
'~/photos/http://www.MyURL.com/photos/4411568359267Pic003.jpg' is not a valid virtual path.
Indicating a line in my code:
var marker = new GMarker(new GLatLng(<%=coordinates%>));
This have never happened before, and I don't know where to start troubleshooting as this script -Google Maps- doesn't even need images, i tried to comment it out, it gave me the same error but on a different script this time, the one that show formatting toolbar for the text areas
Line 8: new nicEditor({buttonList : ['fontSize','fontFamily','fontFormat','bold','italic','underline','strikethrough','forecolor','bgcolor','removeformat'], iconsPath : '../nicEdit/nicEditorIcons.gif'}).panelInstance('<%= txtDescription.ClientID %>');
..please HELP :'(
can you post your fileupload aspx page and your function so we can troubleshoot it.
"'~/photos/http://www.MyURL.com/photos/4411568359267Pic003.jpg'"
look closely at the url, it is tacking the full url on to "i". what type of control or you using, a generic or a server side control
solved, turns out the error is due to old database records when i was storing the whole path in the fileName...Thanks Joshua and Keltex

Resources