Q: Organizing Subclasses & Plugs
Hi, I'm trying to organize my growing code by splitting various Subclasses into separate files. If the subclasses are imported as .js assets, it seems that they can't be loaded ( ReferenceError: Can't find variable: MySubClass ) . Is there a way to have these subclasses elsewhere than in Global.js / Outlet code ?
Also, having a GUI to manage these would definitely help in the design. If we need to pass through iAd-plugs, could you please point out some ressources / tutorials ?
Any comments / suggestions would ge greatly appreciated,
Thanks !
Posted on Aug 21, 2013 3:56 AM
If you add your .js files to the Asset Library, they should "just work". If the .js files are in a folder, and you import the folder into iAd Producer, it will keep the files organized by folder.
In looking at the available example projects, several have a .js file as an asset:
- Cupcake Aviary: CupcakeBuilder.js
- Forms: Validator.js
- Hudson Telegraph: MorseConverter.js
- Space Tours to Mars: Validator.js
In looking how they're used, they appear to be called from an event handler and NOT Global.js, so maybe that's your problem?
Also, I see that iAd Producer supports a "requires" notation, e.g. in Space Tour's TryIt-emailButton.js:
//= requires iAd.MailMessage
So, perhaps you need to add that at the top of your subclass files.
Finally, plugins haven't been documented in a long time, so I guess Apple doesn't want to support them anymore.
Posted on Aug 26, 2013 3:32 PM