Showing black screen when recording a video using camera in iOS 14.2 - uiimagepickercontroller

In my application, I written a code to record a video using UIImagePickerController. It is absolutely working fine with all other devices, only one of my client have an issue with iPhone 8 running iOS 14.2 that while recording video, it shows black screen and no swipe working for front or rear camera on right bottom button.
Here is my code and Image:
UIImagePickerController *evidencePicker = [[UIImagePickerController alloc] init];
evidencePicker.delegate = self;
evidencePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
evidencePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
evidencePicker.videoMaximumDuration = 10.0;
evidencePicker.allowsEditing = YES;
evidencePicker.videoQuality = UIImagePickerControllerQualityTypeLow;
[self.navigationController presentViewController:evidencePicker animated:YES completion:nil];
Camera permission is also given.
So, am I doing anything wrong to present UIImagePickerController? Or something else needs to check?

Before presenting UIImagePickerController check for availability of camera. Something like this:
[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]

I also encountered this problem, my device is 14.3.
My colleague's is 14.6 , the same code 14.6 is normal. I tested it is UIImagePickerControllerSourceTypeCamera this enumeration value problem, if you change it to the default will be able to record video normally

Related

Force qt-vlc to don't hide mouse cursor

I'm developing a video stream software, I'm using libvlc and qt-vlc for playing videos from network stream. Everything is good just one problem. When VlcMediaPlayer starts to playing, the mouse pointer hide over VlcWidgetVideo widget.
If mouse move around application it will be shown but only on the VlcWidgetVideo there are no mouse
My simple code is like that:
auto _instance = new VlcInstance(VlcCommon::args(), this);
auto _player = new VlcMediaPlayer(_instance);
auto playerWidget = new VlcWidgetVideo(_player, this);
auto _media = new VlcMedia(mediaUrl.toString(), _instance);
_player->setVideoWidget(playerWidget);
_player->play();
// mediaUrl is type of QUrl
_player->open(_media);
Now, my question is that: How can I force qt-vlc to don't hide pointer? I want to mouse pointer be visible always. My development environment is:
CentOS 7.2 on VirtualBox
Qt 5.5
Excuse for my bad English
Note 1:
Two points:
Playing same stream video with vlc media player on same computer doesn't hide the cursor!
When I try to simulate the mouse pointer with a shape in QLabel the player widget flush by repeat
Note 2:
I dropped using of qt-vlc and used libvlc directly, But no changes! Mouse hide and some times it appear as a single black pixel
Note 3:
Running same code on debian 9 works fine
Use --mouse-hide-timeout=<integer> from https://wiki.videolan.org/VLC_command-line_help/
If that doesn't work, consider opening an issue as I'm not sure vlc-qt offers a way to configure that option.

How to swipe iOS emulator screen

As soon as I upgraded my local version of Appium, all my swipe logic stopped working. I moved to the non deprecated API, and but I'm till not able to observe swipes. I'm pretty sure I'm just not using the coordinate system correctly but I'm not sure how. I want to swipe vertically down the screen of an iOS simulator to refresh a list view.
Any pointers on how to treat properly swipe and why, and what the mechanics of it are?
Here is my code for swiping
PointOption fromPoint = PointOption.point(
topView.getLocation().x,
topView.getLocation().y);
PointOption toPoint = PointOption.point(
bottomView.getLocation().x,
bottomView.getLocation().y);
new TouchAction(user.mDriver)
.press(fromPoint)
.moveTo(toPoint)
.release()
.perform();
I upgraded my version of Appium and my Java client, but those improvements didn't fix the swiping.
Apparently, one must add a wait duration for the swipe to take place.
WaitOptions waitOptions = WaitOptions.waitOptions(Duration.ofMillis(500));
new TouchAction(mUser.mDriver)
.press(fromPoint)
.waitAction(waitOptions)
.moveTo(toPoint)
.release()
.perform();
This is my code it is working fine for IOS simulator swiping .
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", "left");
js.executeScript("mobile: swipe", scrollObject);

Add attachment image to attributed string in iOS 6

I have spent 3 hours on this but just can't solve it, anybody knows why? please help me!
The code below added an image as an attachment to an attributed string,
UIImage *img = [UIImage imageNamed:imgName];
NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
textAttachment.image = img;
NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment];
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] init];
[attrStr appendAttributedString:attrStringWithImage];
Then I assigned attrStr to a UITextView's attributedText, this works great in iOS 7 but in iOS 6 the image is not displayed, I heard attributedText is supported for UITextView since iOS 6, is there anything different should I do for iOS 6?
PS: in iOS 6, if I assign attrStr to UILabel's attributedText, it is displayed, what's the special for UITextView?
+ (NSAttributedString *)attributedStringWithAttachment:(NSTextAttachment *)attachment is available in iOS 7.0 and later. So in iOS 6 and earlier version of iOS, you may use UIWebView or third library to display image in a Label or TextView.
The NSTextAttachment class available in iOS 7.0 and later,so it is not work for you in iOS6 and earlier version.

Trouble with using popViewController flashing white during transition

I have been struggling with switching between views using the UINavigationalController. I have used this system many times without issue but in my new app it isn't working properly.
Here is the issue:
When i am pushing a new view controller i use the following code:
NewViewController *newVC = [[NewViewController alloc] initWithNib:#"NewView" bundle:nil];
[self.navigationController pushViewController:newVC animated:YES];
[newVC release];
The code I am using to return to the previous view inside of the newVC is:
[self.navigationController popViewControllerAnimated:YES];
I was reading that this could potentially be releasing the self.navigationController itself so I implemented this code:
UINavigationController *nc = [self navigationController];
[nc popViewControllerAnimated:YES];
What results is a smooth transition to the newVC with no white flash, but when returning to the original page the screen flashes white as if it is releasing the newVC before transitioning back to the original page. HOWEVER! When debugging I placed breakpoints on viewWillAppear of the original page and on the dealloc of the newVC and the viewWillAppear + transition with white flash all complete BEFORE the dealloc of the newVC is called.
If anyone could please help shine some light on this I would greatly appreciate it.
Thanks!
~Arash
This is an old post, but for those who may run into this issue in the future, I have solved it by setting the clipsToBounds property of the view of the ViewController to "TRUE"
-(void)viewDidLoad {
[super viewDidLoad];
self.view.clipsToBounds = YES;
}
Try changing the background colors of the various views on the navigation stack to different recognizable colors (including the main window). One of them might be showing for some reason, and if each one has a different color you can determine which one is the culprit pretty easily.
FWIW, this same issue happened for me in a Swift app. The root cause appeared to be that I was doing this:
self.navigationItem.rightBarButtonItem = nil
...to dynamically hide the button, where the UIBarButtonItem had an outlet in the current UIViewController.
I did not actually need an IBOutlet for that button, so I removed the outlet, and it worked.

How to set the view in a landscape mode in iPad?

I'm working with iPad. I want my app to fix at lanscape mode only. My app contains a split view controller and above split view controller I placed login screen.
After user provides the necessary username and password, the login view should be removed so that split view controller gets opened. It works good. But i want login screen to be set at landscape mode. I tried in so many ways but my problem is still not solved. I placed a UIOrientaion key with value lanscape in a plist. But no use.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//UIInterfaceOrientationLandscapeLeft;
// Overriden to allow any orientation.
// return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return YES;
//return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
I tried in this way also but no result.
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
Also in this way in viewdidload,
By using this way im able to set the app in landscape mode but the view is not rotated to landscape.The login view is fixed at potrait mode.
In nib file,if i fix the view in lanscape,the split view's,rootviewcontroller appears on on e side and in the detailviewcontroller of splitviewcontroller,this login screen is opened that too in potrait mode.....
Any help will be appreciated
Thanks in advance
i found solution to my problem.Here is the coding:
[ViewController *newDetailViewController = [[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
[window addSubview:newDetailViewController.view];
[window addSubview:anotherViewController.view];
[window bringSubviewToFront:newDetailViewController.view];
In this way we should add subviews to delegate.After that fix the view in landscape by auto rotation method in view controllers..thats it

Resources