I have created profiles as per the documentation (tablet and phone). If I create a profile and return false from the isActive method, the profile is still loaded and the views from that profile are displayed. Moreover, if I load multiple profiles and they all return false (meaning I wish for the default views to display), random profile views are used (sometimes tablet, sometimes phone.
Loading all classes for all Profiles is actually the intended behavior - if we didn't do this then production builds would not work correctly. As it stands, a production build is a universal app - it works on all Profiles you have defined, without using dynamic loading in production.
The Profile itself doesn't determine which views your app instantiates. At some point your code must be calling something like Ext.create('MyApp.view.someProfile.someView') - the framework doesn't do that for you, it's all in the app itself.
"Once the Profiles have been loaded, their isActive functions are called in turn. The first one to return true is the Profile that the Application will boot with" and "Now when we load the app on a phone, the Phone profile is activated and the application will load the following files:"
Clearly the application is making the decision about which profiles to launch. In our application our views are being autocreated via their xtype as such:
If I have profiles defined in my application controller: profiles: ['Tablet', 'Phone'], then the above code AUTOMATICALLY creates a view from one of the profiles, even though both profiles are marked as inActive. If I remove the profile declaration, then the default views are created.
Ah - sounds like you're registering the same xtype for both the Phone and Tablet profiles, is that correct? That's one are where our guidance could be better - in general that pattern is not a good one as it makes the xtype mapping potentially nondeterministic. I would suggest you use unique xtypes for every component (even if it's just a Profile-specific variant) until we figure out a more elegant solution to this
The framework really should offer a neat way to do this without the confusion though, I don't know what the solution looks like yet (could just be some written conventions) but it's something we're thinking about
Had exactly the same problem - tearing my hair out on this one.
I assumed I could use same xtype across platforms and that profile executed views down the tree from its initial view loaded - even using fully pathed 'requires' statements didnt help.
profile specific xtypes fixed it - thx.
Yes I think some guidance around this in the doco on profiles would be great.