Develop iphone apps with Ruby on Rails and Eclipse, part 1th

Source: Internet
Author: User
Tags touch ruby on rails

Provide content for the iphone

Detecting Mobile Safari with Ruby on Rails application

The IPhone and ipod touch make mobile Safari a popular American mobile browser. Although it is more than enough to present a regular web page with Mobile Safari, many web developers have created an application version for the IPhone. The "Use Ruby on Rails and Eclipse development IPhone app" series will show how to use Ruby on Rails to identify and provide custom content for Mobile Safari on the server side.

Within months of Apple's release of the IPhone and ipod touch, mobile Safari has become a popular mobile Web browser in the United States, and its market share is rising. Since the physical parameters and user interface (UI) models of the IPhone are quite different from those of other mobile browsers, many developers have opted to redesign their Web sites to support the special UI model of mobile Safari.

The decision to create customizations for the IPhone is a compromise between the two more extreme choices. One of the extreme choices is doing nothing. Mobile Safari's flexible interface design allows users to easily browse Web sites, even if they are not designed for mobile devices. Apple follows the idea that IPhone users expect access to full and complete Web. At the other extreme, you can use the newly released iphone software Development Kit (SDK) to put applications on the iphone. This gives you great UI flexibility and allows access to IPhone features that are not available in WEB applications-such as accelerometers or cameras. The downside: Creating a native SDK application costs more than creating a Web application, and if you already have a Web application, creating a custom iphone Web version is the quickest way to provide users with a clean iphone UI.

This article will show you how to build a Ruby on Rails application that dynamically identifies the IPhone or ipod Touch browser (in this article, I mean iphone-remember that all content here also applies to the ipod Touch), while allowing Mobile Safa RI users choose to view the full Web content as needed. This article will also focus on the server-side architecture needed to provide individual content for iphone users and how to start offering content services to the iphone. The 2nd part of this series will focus on how to provide the appearance of the IPhone interface to content.

Setting up the environment

This article uses Eclipse with the Aptana plug-in to provide Ruby on Rails and IPhone support. The Ruby on Rails plug-in will provide ruby and rails-specific syntax highlighting, shortcuts, execution environments, and so on. The iphone plugin will provide a preview of the Web application in the iphone size window.

There are two options for getting a Eclipse/aptana combination: You can add a Aptana plug-in to an existing eclipse environment, you can download Aptana Studio (derived from Eclipse), and then add plug-ins through the startup screen provided by Aptana. If you have already set up your eclipse environment, perform a typical Eclipse plug-in search. Select Help > Software Updates > Find and Install and add the plugin URL provided in the Resources section. You need to have two Eclipse plug-ins to continue. If you are using Eclipse for Rails development, you may already have a radrails plug-in. You will also use the iphone development plug-in, which will provide you with a simulated iphone screen to preview development in the iphone size window. Although this plug-in is designed to preview static HTML pages, it can also be configured to point to Rails applications. Figure 1 shows the plug-ins that are in use.

Figure 1. IPhone Plugin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.