SceneKit SCNNode init(mdlObject:) missing? - ios

I'm using Xcode 7.3.1, Swift 2.x, iOS target is 9.3. I can find convenience init init(MDLObject mdlObject: MDLObject) in Apple docs, but I don't see it in my project. I opened standard game project starter, SceneKit is imported. I've tried:
Double checking iOS version
Adding import ModelIO
Finding "mdlObject:" in header files in SceneKit.framework - not found
Looking for alternative methods (maybe Apple moved it somewhere) but there are no other inits with that parameter, no class function, nor I found any corresponding export function in MDLObject
Cleaning project...
I can see all SceneKit classes, and I can create MDLAsset (part of ModelIO, can return MDLObjects) instance.
Any ideas, maybe I've overlooked something obvious?

the following should do
import SceneKit.ModelIO

Related

Semantic Issue: Cannot find the protocol declaration for ‘ARSessionDelegate’

Do anyone know the workaround for the build error on Xcode?
All suggestions are welcomed.
E.G: Impossible in that way, Possible with Objective-C, not Swift
Environment:
Swift:3.2, Xcode:9.2, Unity:2017.3.0f1, iOS:11.2.1
Condition:
I’m trying to make Native Plugin for Unity using Swift like this.
Unity C# -> Objective-C -> Swift
For now, I could access the iPhone camera roll from Unity.
The Project Name is GetDepthSample here.
Error Detail:
As soon as I add ARSessionDelegate on the class definition, I got the following error.
CameraRollSample.swift
Other Information:
GetDepthSample-Swift.h (generated automatically on Xcode) shows the following error.
GetDepthSample-Swift.h
It’s possible to jump to Definition of the protocol ARSessionDelegate.
Not only ARSessionDelegate but also MetalKit shows the similar error.
The original Unity Project
https://github.com/wapa5pow/CameraRollSample
Many thanks!
Looking at the header that you posted in the comment, it seems to me that maybe you need to include the ARKit framework in the project settings in Xcode. Although this generally tends to work automatically clearly something in your setup has that missing.

How to import Magicalvoxel file into Xcode and use it

I recently came across software called Magicalvoxel. It is pretty cool if I can import some object into my Swift game project. I searched on the Internet but I could not find any good resource, though there were some how to for Unity. In doing so, should I make a game project with SceneKit or Spritekit? I am not sure about how to achieve this.
You can use File > Export > obj and import exported geometry into Xcode.
And you should use SceneKit for such 3d objects.

Objective C - Swift Bridging issue Xcode 6.3 -Screenshot provided-

So, I found myself craving a framework to replicate iOS 6 folders animation. Luckily I found one called JWFolders, which is pretty neat and useful, but my problem is the following:
I am doing my program in Swift, in Xcode 6.3, I imported the header file to the bridging thingy in the swift compiler settings, and as long as I don't try to use anything from that framework, it doesn't complain, but as soon as I try to use it and compile I get the errors shown in the image below.
(even with a simple declaration like this)
var folder = JWFolders()
So, If anyone was wondering, I got it working. I contacted the developer and asked for help, and he nicely told me I was forgetting to add the source code files ".m" to the source compiling files.
After that it worked.

iOS How to use private API?

I don't want to submit this app to AppStore. I've tried for many times but met so many problems :(
I use class-dump to get all the header files of UIKit.framework. In the UIApplication.h generated by class-dump, I saw the method I want to use----launchApplicationWithIdentifier.
Then I put UIApplication.h in my project and import it. Compile, I got a lot of "Redefinition of enumerator...." error because in the UIKit.framework I use previous, there's another UIApplication.h. But this file doesn't have the method launchApplicationWithIdentifier.
If I delete the previous UIKit.framework and import the folder generated by class-dump. Then it appears like a framework but if I unfold it, it's empty.
Then I want to make all generated header files a framework file ant replace the previous UIKit.framework. But I don't know how. As we can see, under the system framework directory, there's a file which has the same name as the framework and has a 'executed shell script' icon. How can I made this file?
I really got confused. Someone can give me a hand? Thank you.
Just specify the private methods in a category interface above the class implementation where you want to use it, like this:
#interface UIApplication (Private)
- (BOOL)launchApplicationWithIdentifier:(id)identifier suspended:(BOOL)suspended;
#end
Don't import the whole class-dump file and link with the original UIKit framework.
You must be very careful when using private API. These methods can change or be removed in future iOS versions!
Check if the method really exists with respondsToSelector: at runtime and be prepared for the case that it does not exist.
I used a secret MapKit feature in my own application and I knew that the private methods only exist in iOS 5. So my app still works in all iOS versions but this feature is only available in iOS 5 (Apple removed or changed it in iOS 6 beta 1).

Transitioning a project from Cocos2d v1.x to v2.x and then to ARC

I might sound lazy but I am slightly confused on how to proceed on this subject. I have followed this guide which is very well done.
My goal is to convert the Cocos2d v1.x game project to Cocos2d v2.x and then refactor the project code to ARC.
To get started I created an empty HelloWorld Cocos2d v2.x project and created the v2.x static library (as from Steffen's guide). I then rafactored the code to ARC and the HelloWorld worked smoothly.
The issue is when I try to add to the same project the classes I had already written that don't complain to ARC (assuming that there will be not many Cocos2d v2.x vs v1.x problems - e.g. use of deprecated methods and classes like TouchJSON - my project doesn't at least as far I can see). So, I added a couple of Game classes that don't depend from the rest of the game (to reduce the number of potential Cocos2d v2. Vs v1 issues) to the project to see if the ARC covnersion worked for those as a proof of concept. After adding them I choosed: EDIT->Refactor option from XCode.
But now the compiler gives me some ARC warning messages like "ARC forbids explicit message send of autorelease" in the following method:
return [[[self alloc] init] autorelease];
Or similar problems with the dealloc method already written.
I was assuming that EDIT->Refactor would have changed the added code but it appears to work only once. Any hint on this? should I add all my code to the new project template before refactoring the code?
EDIT:To verify whether it was an XCode bug I created an empty iOS project with no Cocos2d libraries and then converted it to ARC. Then created a new empty sublcass of NSObject and added a dealloc method and run the conversion again, it did work! So I might have not followed correctly some of the steps to create and link to the static library..
In addition to this there are some other small issues (not XCode related, but Cocos2d v2.x related), like the fact that the CDXPropertyModifierAction is not automatically included to the CocosDenshion folder and I had to add it to the project after creating the static library (when I noticed the issue).. but I guess this is more template creation related.
Thanks for reading!
so, yeah, I can confirm that the solution in the comment did work. As usual with some IT things is was just about playing around a bit with the various options and see if it works changing the prospective (its not a bug but is me being stupid or lazy).
What worked for me was to use the EDIT->Refactor from the XCode menu and de-select the files created in the first instance by the Cocos2d 2.x template that I had converted after creating the static library (e.g. main.m and AppDelegate.m) (ask if this is unclear).
This converted smoothly all my newly converted Cocos2d 2.x classes into ARC complaint classes and yeah, I have my project fully supporting both Cocos2d 2.x and ARC :).
Please find below the screenshot of the files I deselected to get it working:

Resources