UIPrintInteractionController not working properly in iOS 13 beta device - objective-c

When I try to load printer in objective c code the printer view goes out of the screen. Can anybody look into this?
I have tried with delegate methods of UIPrintInteractionController
but presenting the printer controller goes to out of the screen.
This code works properly in ios 12 I want the same printer screen in ios 13
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
[printController presentFromRect:self.actionsButton.frame inView:self.view animated:NO
completionHandler:^(UIPrintInteractionController
*printInteractionController, BOOL completed, NSError *error) {
if (completed) {
[self.actionsPopoverController dismissPopoverAnimated:YES];
self.actionsPopoverController = nil;
}
}];
Screen Short Below

I have faced the same issue. But this an OS issue for iOS 13. This issue has been fixed by Apple for iOS 13.1 beta. Try to run your code in iOS 13.1 beta

Related

iOS 8 UIImagePickerController has black preview in Landscape mode

I am developing app for iPad, in Landscape mode during taking a snapshot from camera a black preview appears.While , UIImagePickerController works properly for Portrait mode.Thanks in advance.
this is my piece of code -
-(UIImagePickerController *)imagePicker{
if(!imagePicker){
imagePicker = [[UIImagePickerController alloc]init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
}
return imagePicker;
}
[self presentViewController:self.imagePicker animated:YES completion:^{ }];
PS: Anybody knows about, "Contacts" default app of iOS device having this feature rotation of camera controls with respect to device orientation.Here, Camera preview looks fine for all orientation.Anybody knows its implementation.
if you are using Autolayout then you first Check for the co-ordinates and size of corresponding preview(UIimageview).

Camera Rotation and OverlayView in iOS8

I am experiencing an issue when using the iPad Camera in iOS 8. I've seen some older questions and a thread on the Apple Developer Forums from during the beta but still haven't find a solution.
There seems to be two parts to this issue.
1) The camera itself rotates when the device orientation rotates, eg the world is on its side
2) When opening the camera in Landscape, the overlay does not appear. When opened in Portrait it is fine.
It is an app using iOS7 as the Base SDK, problem only occurs when running the app on a device that has been upgraded to iOS8. The app is not using storyboards, it is using nibs.
I'm hoping to push out a fix for this with Xcode 5.1.1 before moving onto the iOS8 specific fixes and using it as a Base SDK in the next version.
Here is my code to bring up the camera:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == YES) {
// Create Camera
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.showsCameraControls = NO;
// Set up custom controls view
[[NSBundle mainBundle] loadNibNamed:#"OverlayView" owner:self options:nil];
self.overlayView.frame = imagePicker.cameraOverlayView.frame;
imagePicker.cameraOverlayView = self.overlayView;
self.overlayView = nil;
// Show Camera
[self presentViewController:imagePicker animated:NO completion:nil];
[imagePicker release];
}
I have also tried
And the Layout of the Toolbar (sitting at the bottom) of the OverlayView:
If I change that to sit "at the top" it appears in both portrait and landscape! So it must have to do with the view/window/something size, though it's strange how its behaviour would change when the layout has stayed the same.
I have tried it with both showsCameraControls = YES and hashing out the OverlayView block, and problem #1 persists so it's not to do with the overlay at app.
I'm hoping someone has found an answer to this, it seems like quite a common problem.
Please let me know if you need any further details.
Edit 1: Fixed the Overlay (Issue #2)
It wasn't applying the orientation to the OverlayView, fixed it like this:
// Grab the window frame and adjust it for orientation - from http://stackoverflow.com/a/15707997/520902
UIView *rootView = [[[UIApplication sharedApplication] keyWindow]
rootViewController].view;
CGRect originalFrame = [[UIScreen mainScreen] bounds];
CGRect screenFrame = [rootView convertRect:originalFrame fromView:nil];
...
self.overlayView.frame = imagePicker.cameraOverlayView.frame;
I suspect that it's related to the camera not realising it's orientated too, will keep searching for a fix for Problem #1.
Edit 2: Update on Issue #1
Looks like the camera rotating might be an Apple issue. On iOS8 if you open up the Contacts app, edit a contact and choose 'Take Photo', the exact same issue occurs - in a default Apple app!
I still can't find a fix so I am just destroying and recreating the imagePicker on each orientation change for now, it's ugly but will suffice until Apple release a fix or a better solution pops up.
Apple fixed this problem in iOS 8.1.

Play a sound with silent mode iOS 5 and iOS 6

I'm trying to test to play a song in with silence mode activate.
I have this code which I picked up from the answers in this web:
if(CFStringGetLength(state) == 0) {
//SILENT
NSLog(#"Silent switch is on");
//create vibrate
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
//this 2 line below use to play audio even in silent/vibrator mode too
UInt32 audioCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty( kAudioSessionProperty_AudioCategory, sizeof(UInt32), &audioCategory);
NSError *error;
AVAudioPlayer *player = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL URLWithString:soundPath] error:&error];
[player play];
NSLog(#"error %#",error);
}
else {
//NOT SILENT
NSLog(#"Silent switch is off");
AudioServicesPlaySystemSound(finishedSound);
}
I'm testing in a iPod touch 4 generation ios 6 the sound sounds when the app is in background and foreground (with volume to a minimum).
But with iPad one with iOS 5.1.1 it doesn't sound none of two situations.
The sound sounds with the silence mode off in both devices.
Do you know what can I change to achieve that the app sounds in both situations ?

UIPasteboard: image saving issue

I'v thought that dealing with UIPasteboard is easy but it turned out to be a time-consuming issue...
I want to store an UIImage in UIPasteboard and then paste this image in iMessage, WhatsApp, Gmail... and others.
That's my method where I use UIPasteboard
- (void) postClipboard
{
if ([[modelView currentView] isImage])
{
UIImage *image = [self readyImageLandscape:orientationLandscape];
[[UIPasteboard generalPasteboard] setImage:image];
}
}
It works on iPhone 3GS 5.1. I've tested it on Gmail and WhatsApp
Then I modified the method to
- (void) postClipboard
{
if ([[modelView currentView] isImage])
{
UIImage *image = [self readyImageLandscape:orientationLandscape];
[[UIPasteboard generalPasteboard] setImage:image];
[[UIPasteboard generalPasteboard] setPersistent:YES];
}
}
Still works on iPhone 3GS 5.1.
But my employer says that it doesn't work on iPhone 4S 6.0 neither in WhatsApp nor in any other application.
Am I doing all wrong or there should be another approach to make it work on iPhone 4S 6.0?
See this answer: https://stackoverflow.com/a/12613632/830946
Looks like that code will work with a single image, but not with multiple.

Programmatically launching Camera for video recording

I have quick question. I am using the following code to launch camera and record video on iOS 4.x devices, it works great. I want to use the same code on iPad 2 device as iPad 2 has video recording facility. Will it work? Can someone please guide me?
if ([types containsObject:(id)kUTTypeMovie])
{
UIImagePickerController *pickerController = [[[UIImagePickerController alloc] init] autorelease];
pickerController.delegate = self;
pickerController.videoQuality = appDelegate.settingsCtrler.quality;
pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
pickerController.showsCameraControls = YES;
pickerController.mediaTypes = [NSArray arrayWithObject:(id)kUTTypeMovie];
pickerController.videoMaximumDuration = maxDuration;
[appDelegate hideFloatingBar];
[self presentModalViewController:pickerController animated:YES];
}
Thank you in Advance!
If it builds on iOS 4.3 you should be OK - although I don't have an iPad2 to test it on. I would wrap the logic in a test though:
if([picker isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
// Your code here.
}
so that it doesn't try and present a camera when one isn't available.