Snapshot fails on some iOS devices - ios

I've got an app where I have a GLKit View Controller. I need to get a snapshot of the GL view.
I'm using:
glImage = [(GLKView *)self.view snapshot] ;
where glImage is a UIImage.
It works fine every time on my iPhone 5s (iOS 8.1), but just gives a blank image on my iPad Mini (iOS 7.1) and my iPhone 4s (also 7.1). The image is exactly the size I'd expect but blank.
This feature has been in place since iOS5 so it doesn't look like an OS issue.
Why doesn't this work? Is it a processing issue?
Edit - I upgraded the iPad to iOS8.1 and the problem remains so definitely not an OS issue.

It's not exact answer but you may consider using this method:
In short words it attaches CVPixelBuffer to OpenGL Framebuffer which allows it
to be read quickly by CPU. I am using it to capture video and never had problems
with it. Also it may be quicker then snapshot since it does not require your view
to be redrawn.

Related

Objective C App has wrong [UIScreen mainScreen].bounds value since iOS 16

Device: Physical iPhone X (16.0.2)
A legacy app (Objective C) of my client has worked just fine on iOS 15. On iOS 16 though, the app has suddenly 'shrunken in height'. The app opens as usual but on the top and bottom of the screen, there are black bars, as the app itself seems to be constrained to a certain size.
After some investigation, I found out that the device actually reports its Screen Height to be 480pt (iPhone X). Forcing the UIWindow to have a different size doesn't solve the issue, the app is still constrained to be the same wrong height. It seems the device 'actually believes' to be shorter than it is.
Since this behavior kind of resembles what happens when starting an iPhone app on an iPad (at least I remember seeing something like that some time ago), I was wondering whether or not this behavior is expected as of iOS 16?
If not, I would really appreciate some help here.
EDIT: I learned that +[UIScreen mainScreen] is deprecated as of iOS 16 so using that to initialize the window might be the issue. Though there seems to be no alternative for accessing this info all the way back in the AppDelegate. It was suggested to use self.view.window.windowScene.screen for reading a device's screen size, but sadly this is not accessible in the AppDelegate.
WORKAROUND:
I was not able to find the root cause of the issue but could resolve it by using storyboards to load the initial ViewController. This caused the system to automatically create a window, which was not affected by this weird system behavior.

Rendering on MetalView freezes iPhone 8

When I render an image on MetalView iPhone 8 freezes.
If I choose 12Mpx image iPhone 8 freezes after some time. If I choose an 18Mpx image (or bigger), the phone freezes immediately, even hardware buttons don’t respond for some time.
On other iPhones, it reproduces very rarely.
The application continues to work, touch events come, the code is executed, but the UI is frozen.
I made a simple project without additional code, where it's easily reproducible. It also doesn't depend on UIScrollView (the project has a branch without it) and debug mode. I tested it on iPhone 8 (iOS 14.2, 4.5). On iPhones 7+, 12, 12pro it is not reproduced.
https://github.com/Sanych6666/CoreImageMetalExample
Please fix code for loading image:
UIImage(named: "exampleImage.png")
to
UIImage(named: "exampleImage")
iOS much better working with just image name for this method.
Your's device doesn't support such big metal textures.
So metal context can't process this.
CIContext can, but Metal low level library so you should resolve this manually.
I recommended decrease image resoutions before send it to CIImage.

iPhone application pixelated on iPhone

I've two live apps on Appstore, my one app is looking quite blurry on iPhone 11(which I just bought) and its fine previous models of iPhone, but my another app looks fine on iPhone 11.
The first app which is blurry is built on xib file and base screen size of iPhon SE and second app which look fine is built on storyboard and base screen size is iPhone 8 but I think that may not be the reason.
Blurry App on iPhone 11 (as it look pixelated)
Blurry App on iPhone 8(as it looks fine and crisp)
Xib file of Blurry App
Let me know why this is happening and whats the solution ? Do I need to revamp all screens in project? Looking for suggestions.
Thanks
Finally I found solution and the culprit was iOS 8.0 and Later check. It was unchecked, which I marked checked and added Splash screens for these defined sizes and my whole apps screens became crisp from pixelated.

How can i get resolution of any ios device using AIR..?

I am using flash cs6. and AIR 14. I want to get iOS device resolution in AIR.
My code is:
var screenWidth:String = String(Capabilities.screenResolutionX);
var screenHeight:String = String(Capabilities.screenResolutionY);
By using this code I am getting desktop and android device resolutions correctly, but in case of iOS I am getting the wrong resolution.
Installed app on iPad 3 MODEL is MC705HN/A, the correct resolution is 2048-by-1536-pixel, but I am getting 1024/768.
This solved my problem.
Go into the App Descriptor XML file. Toward the bottom (generally one of the last items in the file), there should be this line.
standard
If it is commented out or set to "standard", this would be your issue. Change it to say "high" and that will enable Retina support. "standard" scales the non-retina display (320x480 on iPhone, 1024x768 on iPad) up. "high" will give you the correct display resolution.
You can also use stage.fullScreenWidth and stage.stageWidth. I think they work well in any device.

Resize effect of iOS launch images (and AIR?)

I have a problem when I use launch images in an Air application. I don't know if this is the expected behaviour, but when the app starts, the launch image is first displayed as expected, however then it gets resized for a second.
I don't care too much about this, although since the iPhone images have to take into account the statusbar, the effect is a bit ugly in this case.
Can this be solved? is it a problem with Air? is it expected behaviour?
I noticed a similar problem with AIR 3.2 and a fullscreen, fixed-orientation (landscape) app in iOS - the splash image starts in landscape, then flips to the wrong orientation during loading. I suspect it's a bug but couldn't find a workaround.
Since I don't see any pressing reason to move to 3.2, I'm sticking with AIR 3.1 for the time being, which displays the splash image correctly.

Resources