NSData initWithContentsOfURL stuck app running on iphone 4s - nsdata

When running on the simulater and on 4G iphone evering works great.
trying to init NSData with a spesific image from url stuck the app when i try to run it on iphone 4S
[[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:
anyone has any idea why?

It was probably a problem with the image...
changing the image link slved the problem

Related

Why does it take so long to load libgphoto2 *.so-files on RaspPi

I'm making an app that grabs a picture from a RaspPi camera using OpenCV.
But first time the app runs, I notice that it takes forever to load (or unload?) .so-files.
I get many lines like these in debug output:
=library-unloaded,id="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",target-name="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",host-name="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",thread-group="i1"
=library-unloaded,id="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",target-name="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",host-name="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",thread-group="i1"
=library-unloaded,id="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",target-name="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",host-name="/usr/lib/arm-=library-unloaded,id="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",target-name="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",host-name="/usr/lib/arm-linux-gnueabihf/libgphoto2/2.5.22/sx330z.so",thread-group="i1"
What does it mean?
Can I make a minimal install of libgphoto2 that only has the RaspPi driver?
I tried moving some of the files so that they are not loaded, but I would like to understand why.

SwiftUI - preview stopped working on one specific device

I was using the iPhone 11 preview until I made some changes to CoreData - now I'm getting a persistent store migration error. If I switch to a different preview profile, everything works as expected.
My question is, how do I reset the iPhone 11 profile? In the simulator I would just erase the app and start over. But I'm not sure how to do that with Canvas. Thanks!
I finally came across the solution, thanks to #Monica Granbois.
First delete:
~/Library/Developer/Xcode/UserData/Previews/Simulator Devices/
Then run this line at the terminal:
killall -9 com.apple.CoreSimulator.CoreSimulatorService
In my case that was a simulator iOS version which was causing a problem. My simulators was using version 13, 13.7 and 15.x. I had the problem only under 13.x and not under 15.x

Black frames when using easyrtc with socket.io

we use EasyRTC for sending image captures from iPad (we create screenshots "manually" and send them via socket.io) to web browser. On the server we have EasyRTC v.1.0.12 and Socket.IO v.0.9.16. It's hard to say what happened (i've just joined the project and encountered this issue. PM says that it was ok some time ago) but recently we started to notice that some frames are blacked-out. We are debugging this issue for few days and we're running out of ideas. We are not sure where the problem is.
We now that we send correct images from the device. We noticed that it happens only when the image is different from previous one (but not always... it's easier to observe it on the weaker internet connection). When the image is "repeated" (i mean it looks the same but from iPad perspective we create it as new instance) everything is fine.
In attachment you can find info from Chrome network debugger. As you can see in thumbnails or images are ok. These with Size/Content from cache are ok but there with Size 0 and Content > 0 are ones which gives black screens when we want to draw them on the canvas.
Any idea what we're doing wrong? How to debug it? It seems that images are somehow downloaded later than we try to draw them?
Our server is on AWS.
You are trying to send the images up as base 64 encoded jpegs. Basically big text strings. The first thing you should be asking yourself is: is the text string I'm sending up getting to the server, or is it getting truncated? Check the length of the string being sent versus the length of the string being sent, and then check the start and ends of the string.
Finally we found the solution which is pretty easy. It turned out that we was trying to draw an image before it was fully loaded. So what we did was to move drawing code to image.onLoad method and now it works as expected.
img.src = "data:image/png;base64, <img content>";
img.onload = function(){
canvas.drawImage(img);
}

Cocos3D template doesn't compile

Just you know, I'm just starting with iOs and Objective-C (3days).
I'm currently making a 3D object viewer.
I want to be able to load a file and display it into a view. Then the user can rotates and zooms on it.
I have first build it with ninevehGL, but it appears that It doesn't support heavy files (>10M) so well.
I'm now trying to go for Cocos3D.
After i installed everything I have created a xcode project using the cocos3D 2.0 template.
This template should display (i guess) a 3D text "hello world".
But it doesn't even compile throwing me the following:
-(void) updateBounds: (CGRect) bounds withDeviceOrientation: (ccDeviceOrientation) deviceOrientation; <---- expected as a type
It appears that (ccDeviceOrientation) is not recognized as a type.
Would you help me with this ?
I have the project on gitHub here under the folder COCOS3D
Also I'm using the followings version of cocos
cocos2D: 2.0.0 8-Jul-2012
cocos3D: cocos3d 0.7.0
I have, at the same time, posted my question on cocos2D forum, Bill Hollings has been kind enough the quickly reply, and pointed me that the versions of cocos2D and cocos3D i use can't work together.
Here is the explanation and what to do.

Error: Terminating app due to uncaught exception 'NSInternalInconsistencyException'

I am getting error on debugger:
cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
cocos2d: Couldn't add image:bg.png in CCTextureCache
* Assertion failure in -[StartTrain addChild:z:tag:], /Users/nishant/Downloads/AnimBear 2/libs/cocos2d/CCNode.m:370
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Argument must be non-nil'
An Application runs on simulator but not on actual device.
please help.. :(
Is your device an iPhone 4? Someone on the cocos2d-iphone forums had a similar problem; this thread documents what he tried and what ended up solving the problem. It's possible that the hd version of the image you are trying to load is too large or is not in the correct format.
If you are running 0.99.5 rc1, you may also want to upgrade to the release version of 0.99.5, as mentioned in this thread about another similar problem.
I had a similar problem, the name of the file was correct, format was correct (was .png) and I had cleaned in xcode and deleted the app from my iphone, yet I still had the error.
As someone else said in the comment, the size of the sprite just might be too large (depending on your memory usage). For me I had all sorts of sprites and stuff flying over the screen. So I resized it and it currently runs perfect.
Also I was using a iPhone 3G.