Where does the method didLoadFromCCB: come from in Cocos2d v3? - ios

There's a method called didLoadFromCCB that you can implement for any class that has been created in SpriteBuilder. This method is called when Cocos2d loads the class from a CCB file.
What I want to know is: where does this method come from?
Xcode doesn't seem to know it exists, as it doesn't autocomplete.
I'm not having any problems with the method, it's getting called and everything is working perfectly, I'd just like to know where it comes from.
Also, I'd like to know if there is any documentation that lists methods like this that can be called on classes loaded from CCB files. I've had a look around www.spritebuilder.com, but there doesn't seem to be anything of that nature.

CCBReader sends this message. You can search the project in xcode if you need to find its exact origin.
The mistake is that this method wasn't declared in any of the CCBReader headers and isn't in a protocol either, therefore Xcode won't autocomplete it because it's considered a private method. This will be fixed eventually.
There is currently no CCNReader documentation besides the code itself. But didLoadFromCCB is the only method CCBReader will send to nodes.
EDIT: I opened an issue regarding autocomplete of didLoadFromCCB, it's been bothering me too.

Related

Difference between scene:openURLContexts: and scene:continueUserActivity

My code has implemented both scene:openURLContext and scene:continueUserActivity methods. However when the coming URL is universal link, the second method is being called. If it is not a universal link (e.g. Custom URL scheme), the first method is being called.
My question is what is the difference between these two, and for the first method, I can have access to source application from URLContext. But for the second one only thing I got is a webpageURL. Is this possible for Universal Link to know the source application
I am a totally beginner to iOS. Please correct me if I am wrong. Thanks!

Old app headers into newer app version? [Jailbreak Tweak]

Sorry, for the confusing title. I am developing an iOS Tweak (for jailbreaks)
What I am trying to accomplish is something I haven't seen people do before but I am sure it is possible!
as an example lets say I am trying to change my username.
in app version 1.0 in the User.h there is a method called
- (void)setChangeUsername:(id)arg1;
which allows the change of usernames within the app, now on app version 1.2
the method is rendered useless / isnt there.
how could I reactivate this method so it allows the change of usernames?
would I have to edit the app binary, or import some old headers, not even sure what the first step of this process is, or if its even possible.
Sorry for the vague example but I hope it is enough information to get what I need answered!
If you would like more information I would be happy to write some more and be more detailed :)
Thank you!
You can't call or hook a function that no longer exists. If you want to change the username you will have to find an alternative method to do so.

How to check or find if there is inbuilt method I can use in xcode documentation

I am a recent xCode developer and I would like to know how to know or find methods like convert numberFromString available as in-built method in xCode which I can use rather trying to manually code with type cast and conversions. Any suggestions to find such methods or best way to utilize xCode documentation ?
Opening the documentation and manually searching for a method in that class or it's inherited classes is like searching a needle in the haystack. Can we search with keywords like 'convert number from string' and I will be notified of such equivalent methods in inherited classes ? Because say I was working with a string, get and set. But NSNumberFormatter class has numberFromString method. How will I be able to know of it's availability in such cases ? Hope this was clear to put my difficulty in finding methods.
Two ways:
Press the option key on the keyboard and click on the class you want to know about. You'll get a nice popup with information.
Or 2. For a more in depth experience, press command and click on the class, you'll go to the class definition with the the documentation in the right panel under quick help.

iOS - when a button is pressed, how do I get the system to make a remote call to my server?

I have been using a storyboard, and I have not gotten into the code much, and now it seems that it is time.
I have a form and when the submit button is pressed, do I need to put code to handle that into the .h or the .m file? Also, are there examples of handling a button and making a remote call that I can reference somewhere?
Thanks!!
You might find Apple's Your First iOS App document helpful; it covers connecting buttons to actions in code.
As for making a remote call; there are many ways. I would suggest you look into NSURLConnection and friends as a stating place, but there are many, many libraries to help with this, such as RESTKit.

NSURLConnectionDownloadDelegate file issue

Now that 5.0 is launched and we can discuss it without breaching Apple's NDA, I have an issue with the new version of NSURLConnection. This has a new delegate, NSURLConnectionDownloadDelegate with two key methods.
connection:didWriteData:totalBytesWritten:expectedTotalBytes: is invoked repeatedly while the file download is progressing
connectionDidFinishDownloading:destinationURL: is called once when the download is complete.
The downloaded file should then be at destinationURL (at least for the life of this method - the intent is that you get it and move it somewhere permanent). The issue is : it's not there. That directory is empty. I have reported this as a bug to Apple and they tell me it is a duplicate of an issue that they are already aware of.
If anyone has a workaround for this, or finds they can use this delegate successfully, please let me know.
UPDATE 10/17/2011 : I've given up on this and gone back to the old delegate which still works fine in 5.0 even though the documentation says the delegate methods are only available thru 4.3.
Apparently only for use with Newsstand apps. This guy might have found a work around:
http://adamernst.com/post/18948400652/a-replacement-for-nsurlconnectiondownloaddelegate
Alternatively, just use NSURLConnection. But heads up if you implement the NSURLDownloadDelegate methods, they appear to override the standard NSURLConnection delegate methods. If it's the handy didWriteData: method of NSURLConnectionDownloadDelegate that you want, e.g. to update a UIProgressView, you can achieve the same by grabbing the total file size from the http response, and by using the didReceiveData: method of NSURLConnection.
Documentation tells the file is only guaranteed to exist while the delegate method is called so you will need to copy it somewhere else the moment the delegate method is called.
Google tells me people are having problems when the Server sends a cryptic filename and/or mime-type.
Folks,
I've recently discovered this new NSURLConnectionDataDelegate protocol. However, the iOS 5 documentation is incomplete.
The New NSURLConnectionDataDelegate protocol is in the documentation, but the new version of NSURLConnection that uses it is not. That documentation still tells us to use the now deprecated NSURLConnectionDelegate protocol methods.
I gather that NSURLConnection will now download data from a remote URL directly to a file on the local disk, much like the NSURLDownload class in Mac OS. How do I figure out how this works?
The header for NSURLConnection hints that the connection object deduces what you want based on which version of the NSURLConnectionDelegate protocol the delegate conforms to. That seems really screwy. I've never heard of using the protocol conformity of a delegate as a way of controlling the behavior of a class before.
Even now NSURLConnectionDownloadDelegate doens't work.
Here is a good replacement:
http://github.com/jbrennan/JBContainedURLConnection

Resources