I've been working through the DemoBots example and having a lot of trouble getting it to work on all devices.
https://developer.apple.com/library/prerelease/ios/samplecode/DemoBots/Introduction/Intro.html
The current problem I'm having is that on an iPad Mini the app launches but crashes when loading animations. It crashes in AnimationComponent.swift on the line that loads an action from a file:
let bodyAction: SKAction?
if let name = bodyActionName {
// crash here
bodyAction = SKAction(named: name)
}
else {
bodyAction = nil
}
Debugging the app reveals that its trying to load an SKAction called "ZappedShake" but crashing with an array out of bounds exception.
On an iPhone 5S it runs fine. My best guess is its race condition with the faster iPhone 5S is loading the file with the action serialized in it, and by the time execution reaches this point the action is available. But on the single core older iPad the file is not yet loaded and the call fails.
Both are real hardware running iOS9 13A4325c, compiled on XCode Version 7.0 beta 4 (7A165t).
Making the problem more difficult is that I can't see where the file that apparently creates the "ZappedShake" - ReferenceActions.sks - is actually loaded. Its referred to by ReferenceScene.sks but nowhere in any of the code or anywhere else in the project can I see that file being referred to.
Is there some sort of name convention magical file loading mechanism for SKActions? Why does it work on the iPhone 5S and not on the iPad?
UPDATE: Found more on this here: http://asciiwwdc.com/2015/sessions/604
Also this year we focused on referencing and instancing.
We know you spend a lot of time designing high-quality content and animations for your games and we want you to let you reuse that content anywhere where you would like to.
We're allowing you to create serialized data files for your nodes and your actions and then add them as a reference instead of just loading them into your scene.
This way, every time you make a change to the source asset that is automatically reflected in the content of your game.
How do I do this for nodes? For nodes I design part of my scene, maybe a background element, or some scenery in our editor with an Xcode and then I can just drag-and-drop those files into my main scene in Xcode and it will automatically create a reference and it is all set up for you.
If you want to do this in code you can as well, you can manually construct an SKReferenceNode, assign it a file name or even a URL and when that content is first presented in your game we'll load in that content based on the latest version of the file that's in your bundle.
We can also do the same thing for actions. With actions go check out our great new action editor and beyond creating and composing the actions in Xcode you can give all them names.
These names are the key to using them in your game. We have added a selector to SKAction called actionNamed. This works just like it does for SKTexture and textureNamed.
You pass in the name of the action you want. We're going to automatically look inside of your app bundle in all of the serialized action files, find the one with the appropriate name and then surface that to the application.
This looks great but I can't find any documentation on it, or figure out how to debug it when it goes wrong.
It's not you, it's iOS. There's a bug with action references affecting 32-bit devices (like the iPad Mini.)
This issue has been fixed in iOS 9.2 Beta 1, according to this thread on the Apple developer's forum:
https://forums.developer.apple.com/thread/17267
Try running on a more recent 64-bit device (like iPhone 6) in the simulator. Or try upgrading your iPad Mini to iOS 9.2 Beta 1. Or just wait for the next iOS release to fix the problem.
The DemoBots game seems to run reliably when compiled with Xcode Version 7.0 beta 6 (7A192o).
Using a different machine (my home laptop) with a fresh install of Xcode the problem goes away. I also note that the first time I tried there were a few minor compile fixes I had to do such as renaming CGPoint.zero to CGPoint.zeroPoint which I guess should have sounded warning bells that there was some sort of version conflict. This time with the fresh install it compiled and ran out of the box.
I still don't completely understand how the reference actions are getting picked up but at least I now have multiple working versions of Demobots so I can just duplicate the working code there.
Related
I created this aupreset to be loaded into an AUSampler in iOS. I followed the process outlined here and used the EPSSampler class for the same post. So, if I run my app in the iOS simulator, on iOS 9, the aupreset loads and I get to play notes. If I run the same app on a device running iOS 6, the preset loads but I get no sound. I have used the same process on simulator and device in the past, but always by filtering the built-in sine wave generator, never with audio samples. Can someone spot what I'm doing wrong?
EDIT I have no way of testing the app on any device running iOS above 6, at least for now.
EDIT 2 To clarify further, this is how my project looks in Xcode, so you know that my files are going to the right places – i.e. the audio files are going to the Sounds folder within the app bundle (I double checked, just to be sure).
EDIT 3 So, I took the Trombone.aupreset from LoadPresetDemo and manually plugged my audio files into it. Magically, it worked. So I figured I'd load it into the AUSampler's GUI through AU Lab, and make whatever changes I needed to make it sound right – i.e., increasing the release time. It stopped working. So, i manually tweaked the working copy to roughly match what I needed (the docs on aupresets plists are surprisingly unhelpful) and I'm rolling with it. It would seem that AUSampler is messing up the preset, at least for iOS 6 on device, which, currently, is the only device I have to test on. Insights?
I didn't really look that deeply, but the file://localhost//Library/Audio/Sounds/C.caf in your file references looks a little fishy. Mine looks like this /Users/dave/Library/Audio/Sounds/C6.wav. Maybe the file:// part is throwing it off.
Create a directory in your iOS project named Sounds (just like your image shows) and put your caf files in there. The URLs will be groked by iOS.
Here is a post that goes into detail.
I found several other threads with similar problems, but no one has exactly the same problems.
Besides it DID work some time! the errors now keep occurring while it was working some time before..
When Running my app, that has a build Target "Today View Extension", I get no actual result.
The Extension is shown in Notification Center, but has no body (Simulator AND device).
Also when I try to run the App (not the target extension) and attach the process manually by PID I get this error:
I also had the error that my Extension (that has a "Bundle Display Name" entry in Info.plist for a custom Name) did show the Name of the Extension-containing App, and not the string that was set in the Info.plist
Strange thing is that sometimes it worked, sometimes it doesn't, but when it does not there were like five different reasons why not.
I want to ask people who have similar/same problems to post them here to collect all the issues appearing and possibly collect workarounds / solutions for these problems.
Thank you.
For anyone having troubles now:
With beta 4 and beta SDK 4 a lot of bugs were fixed:
[self setPrefferedContentSize:]
to set the views size is now working properly (if you have troubles viewing your Extension)
If your updated Extension is not showing in Notification Center be sure to have a look at the log output, there you can see what task the debugger is attached to, if there is "no Selection" try stopping and running again, it will work after some tries!
If you have questions feel free to ask,
Happy coding
I don't exactly have a solution, but I've observed this happening when anything is "wrong" with my Today extension. For example, if I don't have a file properly targeting the widget. I'm guessing that instead of just crashing to the home screen, iOS just gives you an empty widget? I've written about my own issues here, for reference.
I had similar issues. But it seems to be alright now. Since the "Today View" is an extension and is bundled with the containing app, you should just build and run the containing app. From there, you can pull down the "Today View" and if your widget / today view is not added, add it.
You should be able to see all your updated changes without a problem with this and you won't have to attach any process.
I just updated my Cocos2D to the newest version. I am using xcode 5.1 and am also using Spritebuilder. After updating my xcode I have been having a slew of errors and problems with my application. It's quite frustrating, because before I updated, I wasn't having any issues whatsoever.
I currently am testing my app on the iPhone 5S and iPhone 4S. It builds and runs on the 5S fine, but it has some UI issues, such as the titles of some of my buttons not showing up, and some CCLabels not appearing.
When I try to build and run on the iPhone 4S, I get this huge error, that I can't make any sense of:
file '/Users/Mikey/Desktop/MissileMadness.spritebuilder/Source/libs/cocos2d-iphone/cocos2d- ui/CCBReader/CCBLocalizationManager.h' has been modified since the precompiled header '/Users/Mikey/Library/Developer/Xcode/DerivedData/MissileMadness-erzxydvceuwigkcfbtejuhnghdcf/Build/Intermediates/PrecompiledHeaders/Prefix-cgfsucpxydgzhugfgfecjbxgjlks/Prefix.pch.pch' was built
Has anyone ever encountered this? I going crazy because I'm about done with my app and wanted to submit it soon.
it seems like you have an error with a .pch file.
PCH files can dramatically speed up your build process because they are built and cached.
They are not very effective if you change the headers that are included in these things. Usually you would only put headers that do not change.
When updating Cocos for example, XCode may want to use the cached file, which is no longer correct so perform a Project->Clean and then delete your Derived data folder as outiled in the answer of the question below.
Can I safely delete contents of Xcode Derived data folder?
I'm developing an app for iOs using flash air, version 3.8, this version allow me to load a externals swf with assets, flash professional cs6 and flash builder 4.7
I have some kind of lobby where the user select a differents games. If I deploy the app just with 1 game (1 swf), I would loaded a game without problem
But, If I deploy the app with other games, I would just loaded 1 of them swf, but the other games give me this error:
error #2007: parameter possible symbol clash in multiple swfs, abc env must be non-null
The parameter abcenv doesn't exist in my code.
Thanks in advance
I have found exactly the same issue it also happens with AIR 3.9 You can only do this by embedding the game logic into your main menu and constructing classes as you need to. I know this makes the initial part of say your menu heavier.
You can however load in swfs as library assets, if you need this. I think the bug has to do with swfs and a restriction of overlapping classes and the fact that you can only use one Application Domain. But this is my best guess on the underlying restriction with this. If you do find a work around let us know.
I encountered this error and solved it today. After Google I found nothing can help. Now maybe I'm the only person that solved the problem easily. This is my story:
Working on a AIR actionscript mobile project.
In ad-hoc package for iOS, loading multiple SWF files successfully, except two. Those two cause the "Error #2007: parameter possible symbol clash ......" error.
Found there is a very small difference between the normal SWF and the error one: in the error SWF, one MovieClip is 3D transformed, I saw there are three 3D axis above the MovieClip. Then I deleted the MovieClip from stage and Library and replaced with a new one. Problem solved.
Note that I didn't re-name anything, or delete any duplicated things. In fact there are many duplicated things (image file with same name, and MovieClip copied between the SWFs) in the SWF files.
I ran into this same issue. The issue is that AIR for iOS has to compile ALL of the external .swfs together, so if there are naming conflicts, that can cause trouble. This especially seems to be a problem if two or more of the .swfs were made from the same cloned .fla, even if one of the files had changes made to it.
In my case, it turned out that there were several unused earlier versions of .swfs in the folder of .swfs to be loaded (such as external_movie-prev.swf). I was able to solve the problem quite easily just by deleting these extra files.
This is a common technique in development, just to rename a previous version of a file and add in a new version to the folder for testing. In normal software development these extraneous versions do no harm. But in the case of AIR for iOS, this situation can cause your app to inexplicably freeze when you try to go a movie that also has an unused previous version in your assets folder. This took me several hours to chase down, so I hope it helps someone else.
Original post:
I've got an iOS app which happily loads files successfully a few times and then all of a >sudden, with no apparent reason, fails to load the files again. The paths all seem correct >seeing as they load successfully to start with... does any one know of any reason this could >happen?
I first noticed this running the app on an ipod touch but it also happens in the iphone >simulator as well. I'm using XCode 4.2 and iOS6.
Edit:
It turns out that the audio system I was using wasn't releasing the audio player objects properly so presumably they ended up keeping file handles open or something, resulting in new files failing to open. Adding in a release to the audio players when they finished seems to have solved the problem or at least significantly reduced the likelihood of it happening!
If you run into similar problems where files won't open you can check to make sure file handles aren't being left open (each fopen should have a fclose with it when the file is no longer needed).