Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14557] iOS: App stuck at startup when there is no access to the internet and using modules

GitHub Issuen/a
TypeBug
PriorityLow
StatusIn Review
ResolutionUnresolved
Affected Version/sRelease 3.1.1
Fix Version/sn/a
ComponentsiOS
Labelsapi.appcelerator.net, ios
ReporterAlberto Marcone
AssigneeUnknown
Created2013-07-15T12:49:38.000+0000
Updated2018-02-28T20:03:20.000+0000

Description

Problem Description

Once you add modules to a project, the deployed app in device will get stuck in the splashscreen trying to contact api.appcelerator.net. This is only happening if you are using modules and you are connected to a non-working wifi (i.e., connected to a wifi router without actual internet connection).

Steps to reproduce

1. Create a new mobile project (support for iOS) 2. Add any module to the project. 3. build to device. 4. Deploy the app to a device, connected to a wifi router without internet access 5. The app will stuck in the splash screen for 20 or more seconds.

Extra info

I have customers with local wifi connection but without internet connection. I need to load few modules inside my app, but in doing so my app would get stuck at splashscreen for 15-16 seconds average (sometimes even longer, depending on the configuration) while trying to contact api.appcelerator.net . The app will get started right after the http call times out. Configuration: - Analytics is set to false in tiapp.xml - The app will present this issue no matter what module is included (even modules not downloaded from the market, but compiled from scratch) - The app won't present this issue if wifi and 3g are turned off. - The app won't present this issue if I don't include any modules. - The app won't present this issue if I compile it with TiSDK 2.1.4.GA

Related community issues

http://developer.appcelerator.com/question/154877/app-stuck-at-startup-while-trying-to-contact-apiappceleratornet-possible-regression#comment-182278 Old related questions: http://developer.appcelerator.com/question/138340/app-not-starting-because-of-httpsapiappceleratornet443 http://developer.appcelerator.com/question/139316/app-not-working-because-of-connection-to-apiappceleratornet http://developer.appcelerator.com/question/126909/why-application-try-to-connect-to-apiappceleratornet-at-launch

Comments

  1. Alberto Marcone 2013-07-19

    since there's no possible workaround here, any possibility to have a deadline for this? so that I can give an answer to my customers demanding when this is going to be fixed. Thank you
  2. Eric Merriman 2013-08-07

    Attempting to reproduce, will update.
  3. Eric Merriman 2013-08-07

    Created a default template application with 3 modules attached using SDK 3.1.2 and Studio 3.1.2. Initially forgot to set analytics off. Connected to router with no actual network connection and launched on the following devices: iPhone 5 - iOS 7 beta 5 iPhone 5 - iOS 6 iPhone 4 - iOS 5 Remember, analytics was on. Results: iOS 7 device took 25 seconds to move off splash, other devices were around 4-5 seconds. Turned off analytics and retried. All devices were quick to load, and saw nothing in the console output. Will take this to the module team and see if they can shed any light on the situation. [~a.marcone] Is there any network usage in the modules you are using? I am trying to see what other variables are in play here.
  4. Eric Merriman 2013-08-07

    [~a.marcone] Also note, this is not a factor in production builds. You should be able to build ad-hoc and install on device with no issue. We will continue to investigate.
  5. Alberto Marcone 2013-08-07

    I tested every possible scenario, and loading any kind of modules made the app freeze while contacting api.appcelerator.net (saw that from the logs of the sniffer on the router). I will prepare a test case easy to reproduce. Haven't tested SDK 3.1.2 though, as mentioned above, only 3.1.1.GA . The bug is consistent, a good number of customers complains about that. There are few of them having the app stuck for even 20 minutes since the router configuration doesn't drop the http connection. It's only weird that this time I'm the only one reporting this problem. My app isn't distributed from TiStudio, I compile it from Xcode and then distribute it from there. Something that I recently noticed: it seems like xcode doesn't seem to switch to production mode. For example, I had the Appcelerator red screen error appearing on the AppStore. Could that be the problem?
  6. Alberto Marcone 2013-08-30

    I can confirm this. It does happen only in development. If I distribute it through TiStudio it doesn't happen. So, how do I switch type of build in xcode? I still think this is a bug though, the fact that tries to connect to api.appcelerator.net without my consent shouldn't happen even during development.
  7. Eric Merriman 2013-09-03

    [~a.marcone] - Hmmm.... That is an interesting question. There are a few things done by our build process prior to sending anything to Xcode. I will ask dev to comment on the possibilities for creating in Studio then running from Xcode. Can you give a little more detail about your workflow? Do you create the project in Studio? What do you use to develop? I can tell you a Studio project (the Xcode project) will look different at creation, after build for simulator, and after build for device.
  8. Chris Barber 2013-09-04

    If you build for the iOS Simulator or and iOS device, the deploy type will be set to "development" and "test" respectively. Adhoc and Appstore distribution builds will set the deploy type to "production" which will suppress errors. I recommend building your app for dist-adhoc or dist-appstore, then open the generated Xcode project. When you do the build, you pass in the --build-only flag to skip the actual packaging. Another way is to manually modify the build.manifest file in the /build/iphone directory. You can set the deployType to "production" to suppress the errors. I do not recommend doing this, but if you do, at least do a device build so that the JavaScript files are minified.
  9. Alberto Marcone 2013-09-04

    I understand this. I mainly use xcode for: - possible customizations of parameters in the project - having all my app stored to the archive for all of the app sent to testers or to the appstore. It's strange that I have to build and create an ad hoc ipa and then open the result xcode project and build it from there. Is this what you're suggesting? I thought that running the project from Run would automatically set it ready for production, while running it from Debug would consider it still development. I think I will consider to manually edit the manifest file every time. Isn't there any way to set it to production from xcode itself?
  10. Chris Barber 2013-09-04

    [~a.marcone] There's a lot of confusion around deploy types and build targets. Currently build targets (simulator, device, dist-adhoc, dist-appstore) dictate the deploy type. The deploy type then dictates several things such as JavaScript minification/encryption, analytics categorization (when analytics is enabled), module verification, whether error messages are displayed, and so on. I'm in the process of trying to decouple this, but it's a very slow process. In Titanium 3.X, device builds are pretty much identical to distribution builds except they are signed with a device cert. By running a dist-adhoc or dist-appstore build, it will properly create the build.manifest file in the build/iphone directory that is set up for production builds. You could hack a device build's build.manifest, but I don't recommend it. You should never tinker with the Xcode project from a simulator build because we symlink files and skip a bunch of stuff like copying fonts. There currently is no way to set it to production from Xcode. It will probably make sense to introduce that when we work on the "titanium export" command that will generate a self-standing (no Titanium required) Xcode project.
  11. Eric Merriman 2013-09-05

    Alberto, when you create a dist-appstore build (package from studio, or pass in the dist-appstore from the CLI in terminal) the project is put into the archive. From there you can re-sign out as an adhoc build using "distribute" or you can submit to the app store. This does not account for your desire to change parameters in the project however. Just FYI.
  12. Alberto Marcone 2013-09-11

    Eric, that's pretty cool, didn't know that! Thank you. It's just that having a full archive with everything I compiled ad hoc resulted very handy, since sometimes we do installations on site and we keep track (through the archive) of what we installed where. Well, never mind, I'll stick to the way it is. I will remember to create an ad hoc project every time I need. Thank you everyone for your support and help. On a side note, going back to the original thread, IMHO I still think that one should be able to disable the module check at the boot even when in development.
  13. Eric Merriman 2013-09-16

    Alberto, we will leave this open so we may continue to investigate solutions.
  14. Sabil Rahim 2013-10-02

    https://github.com/appcelerator/titanium_mobile/pull/4756
  15. Alberto Marcone 2013-10-03

    Hi Sabil, after I saw your code one question came to my mind: that means that I can use expired modules when I'm offline, right?

JSON Source