Mostrando entradas con la etiqueta problems. Mostrar todas las entradas
Mostrando entradas con la etiqueta problems. Mostrar todas las entradas

lunes, 6 de mayo de 2013

I thought I removed the file...

Sometimes, when you are sure that everything is alright because the app runs perfectly on all your devices, one of your testers report a bug saying that the app shuts down while loading in some scene (well, they just say something like "yeah.. I select all the items and then, it closes and I cannot continue"). You have very few information, so you start summarizing:
  1. It cannot be memory warning (always first guess, but you test with an iPad 1, the iPad 3 cannot raise this problem)
  2. It cannot be a weird behavior of the inner logic because it is just a background and some sprites...
  3. This scene had previously worked, and then I changed the background...
  4. If the background is not found?
  5. (After look in the project) But the background is not in the project... Why is it working in my devices if there is no image?!
It has happened to me to many times so I decided to write this post.
The first time I saw this issue was when refactoring my code and stop using retina resources, so it turned from having background-hd.jpg and background.jpg to just background.jpg. I removed the file from the project, clean the cache and made sure it wasn't the old file there anymore. But, somehow, XCode seemed to remember it, so when I asked for this file in my devices was ok but my testers iPad hadn't that resource and crashed.
I was very crossed, because I didn't want to rename all files to solved the problem. So, I asked the Almighty and found some solutions on Stackoverflow. The problem relied on XCode's derived cache, and there were offered some solutions:
  1. Clean via XCode (source)
    • The problem remained
  2. Going to the folder in your laptop and cleaning the data manually: ~/Library/Developer/Xcode/DerivedData/ (source)
    • It didn't worked for me, my corresponding folder was empty
  3. Delete app, clean everything, empty caches (source)
    • Still there
How did I solved the problem? I did not solve it :( I solved my concrete bug manually, by renaming the files and the path names in the code.
Why did I write this post? To show you potential problems you may have with XCode and the resources, and a non-perfect solution for it. Also, if you find a good way to get rid of this ridiculous issue that makes stupid names of our resources, feel free to share it with a comment.




viernes, 5 de abril de 2013

'Kamcording' your app

When you are a programmer, you get used to searching for new tools, fighting with poorly documented frameworks, and searching for solutions of problems that come with new staff. You also end up learning when to discard a tool. Tools may be bad, may not adjust to your problem, may give you more problems than solutions... or may be exactly what you are looking for... But what makes a tool great is the people behind it, a technical support that turns problems into solutions. And that's exactly how I would describe Kamcord.

The moment I saw this tool I knew it could be perfect for the new game we are designing, so I decided to make a project to test it. I had two problems: one with the rotation and the other was causing a crash with certain iOS version. Thus, I wrote to the supporting team. The answer was really fast and solved the orientation issue. They needed more information about my devices and project in order to solve the crashing problem so we exchanged several mails, projects, framework's updates... In just 5 days I had the whole project perfectly working. I didn't have to insist, but they were working on my problem till they got to the solution. And every mail was really polite. I'm very happy with the support I've received :)

Kamcord, this amazing tool, is a framework that allows your app's users to record the flow of the app and share it with friends. Easy and well documented.

Available for Cocos2d and Unity. Download from the web and follow the tutorial, it's well explained.
  1. Copy the Kamcord folder into your project.
  2. Add the framework and other supporting frameworks (twitter, mediaplayer, ... ).
  3. Adjust the settings for iOS < 4 (turn to optional some of the just added frameworks).
  4. Add to 'other linker flags': -ObjC -all_load -lxml2

At this point, it should compile, if not, check all the steps. At my first attempt it failed but I realized I  had skipped the third step.

On the other hand, Kamcord uses their own glview, therefore you have to do some changes in your AppDelegate.
  1. Make the root view controller extend from KCViewController
  2. Instantiate the glview as a KCGLView instead of an eaglview
  3. Set the root view controller to the window
  4. Configure Kamcord and set your developer key, secret and app name.
Notation for the comments:
Indented // comments: cocos2d autogenerated;
Non-indented // comments: code not anymore needed;
Indented //* comments: Kamcord explanations;
Non-indented //* comments: mine

Now, adding the functionality is really easy:
  1. Import the Kamcord framework on each scene you want.
  2. Call startRecording when you want to start the video
  3. Call stopRecording when you want to stop the recording
  4. Call showView (normally after you have record) to show the replay and share options of Kamcord

It will look like this









And you can see the video here :)