Object disappear from Scene - ios

I use SceneKit to construct a 3D Scene, which contains a few object. I convert all the COLLADA file and OBJ file to SCN file. Then I use a blank SCN file to put all the object together.
It looks fine in SceneEditor. And it runs on iPad. Everything looks exactly like it was in the SceneEditor.
Then I come up with some idea with the scale of one object. I change it in the property bar. It looks nice at the SceneEditor. And I tried to run it again.
Then boooom.
There was only one object left in the scene. Everything was gone. I can see all the object on SceneEditor. They just not show up on my iPad.
This happens all the time -- after I change any property of any object on the scene, the scene went wrong.
So far I was trying to build a new SCN file again with all those objects. But as the project gets bigger this might be a nightmare.
What is going on? Do you guys have any solution?
UPDATE:
I've notice that the Full Path of the normal SCN files I add in the scene look like: "/xxx.scn". But after some editing, it automatically changed to "xxx.scn" without slash. I think this may be the reason why objects disappear. The wrong path leads to nil and BANG.
Everytime when I use "Quick View" it will automatically change the Full Path. Even if I don't do anything.
I tried to relocate the file but the Full Path stay with no slash. PLS someone help me with it.

Related

ios - loading decoupled view from nib file

I am having difficulty with something that seems to be trivial. I am following this project https://github.com/eppz/iOS.Blog.UIView_from_Xib and trying to implement the decoupled way of loading a view from a nib file. I was not able to get the desired result in my app (nothing shows up and I get no crashes either) so I did the following:
I took the project from Github https://github.com/eppz/iOS.Blog.UIView_from_Xib
I then proceeded to duplicate the files in the "decoupled" group and name it something trivial like "decoupled2". Basically I am creating a whole new class that stands on its own with its own nib file.
I then changed all of the internal tags and class references. Then I made sure that all of the new references were pointing to this new class.
At this point I added a 6th button to the main VC and made sure to call the right method for my new "decoupled2" class when this 6th button is pressed.
PROBLEM: Everything runs but the view from nib does not show up. Debugging view hierarchy shows nothing. Clicking the 5th button still works, so I didn't break the existing code. Why won't the newly created nib file show up?
This seems rather simple, just duplicate what already works in a project that already works and it will work...or not. What am I missing? Thank you for your help.
I have spent a few days on the problem already. Lots of research but nothing of use so far.
I re-did the task and it worked this time.
Maybe restarting Xcode 8.0 was the key or something else that is under the hood.

Xcode jump from viewcontroller.swift to storyboard

I'm working on a large ios app and I'm also a newb. I'm trying to find the correct scene in a storyboard in a large app. I'm in the .swift file and I need a quick way to figure out which scene is associated with that swift controller file. The only way I know now is to go through each scene and look at the Class property, which will take forever. Is there a shortcut to jump from the swift file to the associated scene?
In Xcode, open "Find in Workspace..." (Command+Shift+F)
Type the name of your ViewController.
In the results panel, check the entries under the .storyboard file. Clicking on them will open that exactly scene in the Interface Builder.
Profit.
You can also go further and filter the search by filetype. Check this out:
Create a custom Scope:
Super awesome result:

uiview deleted from storyboard is still showing

I have a very strange behavior in my ios app, if I go to the storyboard and delete the UIImageView object and then run the simulator it still show the image.
Any ideas?
I know why you don´t believe me, I didn´t beleive it either when I saw it, but I just found what(not why) was hapening: the problem was that I messed with the main storyboard configured in the project->info, somehow it was calling the old storyboard and i say somehow because there was no file with that name, it was not enough to change the property to the actual storyboard file, I needed to create a new one.

CUICatalog: Invalid Request: requesting subtype without specifying idiom

Whenever I run my sprite kit app this error is logged constantly. It makes it really hard to debug because the log is filled with these messages. They don't seem to effect how the app runs, so simply suppressing the error would be sufficient. Anyone have any idea how to fix this?
I think that it's just a left over debug message that hasn't been cleaned up in iPod/iPhone devices.
In my app, the issue seems to be related to using Sprite Atlases in an xcassets file.
if I initialise a sprite with:
SKTexture(imageNamed: "Sprite")
I get the message; However, using the following:
SKTextureAtlas(named: "Atlas").textureNamed("Sprite")
I do not get the message.
Also, any sprites created in an .sks file will display the error, as you have no opportunity (or need) to define an atlas.
I agree that this is an bug in SpriteKit. I'll share what solved it for me.
I was keeping my image assets within a folder inside Assets.xcassets:
Like all the images in my project, I was loading the images as textures like so:
myTexture = SKTexture(imageNamed: "iPhoneX")
This was causing the error message to appear in my console. As suggested in Darren Branford's answer, I tried doing it the following way instead:
myTexture = SKTextureAtlas(named: "MyTextureAtlas").textureNamed("iPhoneX")
But the error messages still appeared. My solution was to remove all those images from the folder within Assets.xcassets, delete the folder, and keep all the images individually at the top level of Assets.xcassets:
The error messages no longer appeared after this. Granted, I would prefer to organize the images in Assets.xcassets using folders like I was doing before. But this is a rather small project with not many images, so I can live with it. In a larger project with lots of image assets, I can see how this would be much more of a problem. Hopefully Apple will fix this bug someday.
Aside:
It may be of interest to note that the console warnings did not appear when creating the SKTexture using one of these images. What triggered the warning was when I ran the texture's size() method and assigned the result to an SKSpriteNode's size property:
size = texture!.size()

Cursor loading issue

I have a few questions about a custom cursor in XNA, because I'm new.
I'm using:
cursorTex = Content.Load<Texture2D>("ico.png");
where cursorTex is a 2D Texture to load the cursor. However, it says file not found - even though it is in my Content directory. What's wrong and how do I fix this?
How can I set onMouseOver on certain buttons to react to change the cursor's image? And also, how do I change the image when the user is holding click?
Load the texture as
cursorTex = Content.Load<Texture2D>("ico");
instead of
cursorTex = Content.Load<Texture2D>("ico.png");
Edit: seeing you placed your file in a folder, just load it as ...<Texture2D>("other/ico");

Resources