Quantcast
Channel: www.iphonelife.com
Viewing all 13234 articles
Browse latest View live

Tip of the Day: How to Adjust Siri's Volume

$
0
0

Have you ever wanted to tell Siri to keep it down or to speak up, but couldn't find where in the settings to adjust the virtual assistant's volume? That's because there is no Siri volume control in Settings.

Asking Siri to adjust it's own volume doesn't work either. You may recognize these Siri replies from your own attempts to adjust the volume:

  

The solution, however, is very simple: In order to change Siri's speaking volume, press and hold the home button to activate Siri and then use the volume buttons on the side of your iPhone to make the voice louder or softer.

It seems obvious now, doesn't it? But when I took an informal poll before writing this tip, a surprising number of iPhone users didn't know how to adjust Siri's volume. You are now one of the elite few who know!

 

Top image credit: Michael Pettigrew/Shutterstock.com


Pocket Will Change How You Surf the Mobile Web

$
0
0

Pocket (Free)

iPhone Life Rating: 4 out of 5 stars

There are a lot of things we take for granted when it comes to iOS and other mobile devices, including the frankly insane fact that we now have the ability to look up virtually any fact, article, or answer in mere seconds. While the iPhone may have killed the good old-fashioned pub argument, it's also allowed us to research anything we want and read millions of new opinions and stories on the go. But there are only so many hours in the day, and you can't tap on every link you want—after all, you can only really read one thing at a time. Safari has a Reading List option that saves sites for future reference, but there's no cross-platform capabilities; it only syncs up with Safari on your desktop, and it automatically removes pages as soon as you've visited them (even if you're not done with them yet). Bookmarking can work, but things can very quickly become cluttered as you mingle the sites you only mean to revisit once and the more permanent stuff you want to actually have, y'know, bookmarked.

Enter Pocket, by Read It Later Inc.; it is hands down the most-used app on my iPhone, and probably the best app I've ever downloaded in five years of iOS ownership. That's a bold statement to make, I know, but Pocket's incredible versatility, simplicity of use, and cross-platform capabilities have transformed how I consume information online. Pocket has a simple job; it saves links and web pages so you can come back and read them later. But unlike a bookmark bar or reading list, Pocket's mobile app is a dedicated space with a beautifully clean design, and which displays articles in a mobile-friendly text format that can be downloaded for offline reading. At time of writing, Pocket has more than 12 million registered users.

What really sets Pocket apart, though, is that your archive is accessible not only from your phone, but also from browser extensions for Firefox, Chrome, and Safari. Log into your Pocket account on your computer, save some links, and they'll show up in the iPhone app in a mobile-friendly article format. When you finish with something, it'll get saved into your archive where it can be found again if needed. Pocket also gives you the option to organize your collection with tags (I have one called “inebriated ponderings”) and mark articles as favorites. While reading, you can select a desired font and word size, invert the background color for easier reading in the dark, and even send links to friends.

Pocket does offer a Premium upgrade for $4.99/month, which adds features such as permanent archives, suggested tags, and a more powerful search option; I can't comment on whether it's worth the investment, as I haven't tried it myself. That said, I've been satisfied with the free version on virtually every level. My only complaint about Pocket doesn't really concern the app itself, but instead the apps which don't connect to it. You can set Pocket as your default “read it later” service in over 500 different apps, including Twitter, but if you're browsing mobile Safari you'll need to use a bookmarklet to save something. But that's a minor complaint about a product that has made my life so much simpler and more informed. Gone are the days of having twenty browser tabs opened to content you want to get around to reading but never do; Pocket gives you the space to store your future reading material, organize it, and handily access it whenever you have a few spare minutes on the bus.

 

Pros:

Beautiful minimalist design, cross-platform capabilities, unlimited storage

Cons:

Doesn't connect to certain apps, can't be enabled as the default page-saving option for your phone

Final Verdict:

Pocket's iPhone app is useful, lightweight, easy to navigate, and extraordinarily handy. It has changed the way I use the mobile web and streamlined my browser bookmarks and Twitter favorites, among many other things. I can't recommend it enough.

Are Most Games on the iPhone Really Worth It?

$
0
0

With the introduction of the iPhone in 2007, a new demographic of gamers was created that could only be paralleled by the release of Nintendo's Wii in 2006. The iPhone is now technically the highest-selling portable gaming device, and yet challengers such as myself will still come along and ask: are most iPhone games really worth the money that some developers are charging us?

The notion of paid downloadable content (that is, content that is available to purchase within the game that you're playing) has been a controversial business practice since Microsoft popularized it on the Xbox 360. It seemed to work for classic titles such as Gears of War, but then there were all those countless casual titles that were lackluster in comparison, and provided content that cost half as much as the game itself.

My issue with the iPhone is that it seems like every game on there is like this. Maybe I'm not the intended target audience for these games, but it seems disconcerting to me that some developers for the iPhone are only using paid downloadable content as their own personal piggy bank. 

For instance, I recently saw an iPhone game which advertised itself as being free, until I downloaded it and was bombarded by requests to shell out $10 or $15 for asinine content such as a Santa hat. Let's compare this to the aforementioned Gears of War, which provided new maps for as little as $12; this translates to countless hours of fun with your friends. Now, let's go back to the Santa hat; does it really have the same value?

I won't share the name of this title, because I don't want to embarrass the developer. The point is some of the developers on the iPhone really need to step their game up if they want our dollars—personally, I'd be much more interested in spending $5 or $10 on a game that's actually good, than in downloading some free game that later turns out to be a cash suck.  

The level of quality for iPhone games is really poor and I sincerely wish for it to be enhanced, because I personally don't see the iPhone as a bad device to play games on. It just turns out that most of the games that are made for it are bad.

Top image credit: Radu Bercan / Shutterstock.com

Concerned About Radiation Exposure From Your iPhone? You Should Know About Vest Tech.

$
0
0

I absolutely love the concept of Vest's radiation protection iPhone accessories. I think it’s a brilliant and a much needed solution to a problem that many of us may not pay much attention too; how do we stay connected to our favorite and most used technology without exposing ourselves, or those around us to possibly harmful levels of radiation? Well, Vest aims to tackle this issue head on with their radiation-minimizing iPhone 5/5s case and headphones.

Vest products aren't for everyone. While it's common knowledge that out iDevices expose us to radiation, whether those radiation levels are harmful or not is an issue that is still being hotly debated. The National Cancer Institute says the studies completed so far have failed to reliable prove a link between smartphone use and cancer. But according to the World Health Organization's Dr. Keith Black, the results of exposure may take decades to appear. While the science may be inconclusive and the studies ongoing, for those of you who would rather err on the side of caution, there's the FCC tested and approved Vest.

If you can't see the embedded video, just click HERE.

 

Vest Headphones:

Concerned About Radiation Exposure From Your iPhone? You Should Know About Vest  

I think the Vest headphones ($49.99) are great, even if they don’t have quite the audiophile excellence of some of the high-end headphones on the market these days. That someone is addressing the possibility that it may not be the best idea to plug our iPhones directly into our craniums via electrically conductive wires is a good thing. By providing consumers with an alternative way of listening to content or phone calls on our iDevices, without having to hold the device to our heads or using conductive headphone cables that plug into our ears, Vest has come up with a product that has a built-in, health-conscious clientele.

Concerned About Radiation Exposure From Your iPhone? You Should Know About Vest

The headphones rely on a pretty simple design to break up the electromagnetic frequencies (EMFs). Utilizing quality speaker drivers, the Vest headphone features a unique system whereby the speaker is located where the electrical audio cable and the plastic silicone tubes meet at chest level. From there the audio branches off to the left and right to reach the ear canals via the sound-channeling tubes. According to Vest, the air in the tubes effectively breaks up most of the electromagnetic energy that a wired headset would otherwise transmit into your head. This headset gets high marks for blocking 98 percent of the radiation you would be exposed to using conventional headphones, and gets reasonable marks for sound quality. In terms of sound, I preferred the Vest headphones for phone calls most of all. While they can also work for games and even music, their sound quality is about on par with Apple's earbuds, which isn't bad when you think about it.

iPhone Life rating: 3.5 out of 5 Stars

 

The Vest iPhone 5/5S Case:  

Concerned About Radiation Exposure From Your iPhone? You Should Know About Vest

On one hand, I’m a big fan of a product that would protect me, and those around me, from any questionable levels of radiation exposure. On the other hand, I use my iPhone a lot and I use it hard. My iPhone comes on all kinds of adventures with me. Having a case that offers a good level of protection for my iPhone is important to me. Afterall, if I’m traveling or adventuring, what good is an EMF protective case if my iPhone can’t stand the shock of a fall or a splash of water. And perhaps that’s the main shortcoming of Vest’s iPhone cases ($49.99); there is only one style, and that style is not very protective. This means that for many of us, the Vest iPhone case doesn’t offer enough protection for our active lifestyles.

Concerned About Radiation Exposure From Your iPhone? You Should Know About Vest

I suppose this wouldn’t be an extremely significant point if the iPhone’s demographic wasn’t so outgoing and adventurous, but the fact of the matter is iPhone users tend to be rather hard on their—iPhone’s as the success of companies like Lifeproof and Otterbox will attest to. So for a company to produce an anti-radiation case without taking this into greater consideration is something that I’d love to see change. I can’t tell you how many people I’ve told about this case, only to have them decide against getting it because it wasn't protective enough. What I’d love to see from Vest is an upgrade to their entry-level EMF protective case, so that instead of a minimalistic protective case, their entry level case was at least a two layer, silicone/polycarbonate affair, perhaps something akin to Acase's Superlegerra PRO. Then, in addition to that I'd love to see them develop a heavier duty EMF protection case. One that is more along the lines of an Otterbox Defender or Ballistic Every1 design. It seems essential that this company expand the variety of their case designs. I love the concept, and the product line has great potential. I believe that a great number of people might opt for a case that protects them from radiation, if it also offers a decent level of protection for the iPhone itself as well. Not that a minimal protection, anti-radiation case won't be sufficient for a lot of people, and it may do alright in terms of sales. Nonetheless, I’m afraid this company (like it’s predecessor, Pong) will have a harder time gaining traction and saturation in the iPhone case market, as long as they only offer this one case design.

In terms of fulfilling its intended purpose of blocking radiation while optimizing signal strength the Vest iPhone case does very well, but in terms of being a versatile case, or a technology that can be had in a variety of protective shells, the Vest case is lagging behind the competition.

 

iPhone Life rating: 3 out of 5 stars.


 

If you are curious, (I know I was!) to review a list of cell phones according to their SAR (Specific Absorption Rate) levels, click HERE. Heads-up, the iPhone is relatively high up there in terms of its levels of radiation emittance.

 

Top image credit: lassedesignen/Shutterstock.com

Unleash Your Inner App Developer Part 15: Core Data Next Steps

$
0
0

Do you have an idea for an app but lack the programming knowledge to begin building it? In this weekly blog series, How to Unleash Your Inner App Developer, I will take you, the non-programmer, step-by-step through the process of creating apps for the iPhone, iPod touch, and iPad. Join me each week on this adventure, and you will experience how much fun turning your ideas into reality can be! This is Part 15 of the series. If you are just getting started now, check out the beginning of the series here(This post has been updated to iOS 7.1.)

In my previous post in this series, I discussed some of the basics of Core Data, the technology that allows you to store and retrieve information on an iOS device. You learned about entity data models, databases, and how you can improve on Apple's default Core Data implementation. 

In this post, we will apply what you have learned and add Core Data to the iAppsReview project. You can get the latest version of iAppsReview at this link. I recommend working through the steps outlined in this post on your own, but if you run into difficulty, you can get the completed projected from this link.

Adding Core Data to iAppsReview

As I mentioned in my previous post, I highly recommend not using Xcode's Use Core Data option when creating a new project. So how do you add the necessary Core Data components to a project? There are two main steps you need to perform: 

  1. Add CoreData.framework to the project;
     
  2. Add an entity data model to the project.

With this big picture in mind, the following steps provide detailed instructions for adding Core Data to the iAppsReview project.

  1. In Xcode, open the iAppsReview project;
  1. In the Project Navigator, select the very first project node (Figure 1) to display the Project Editor in the center of the Xcode window;
Select the project node
Figure 1 - Select the first node in the Project Navigator.
  1. If it's not already selected, select the Project Editor's Summary tab, then scroll down to the Linked Frameworks and Libraries section and click the plus (+) button (Figure 2);
Click the Add Framework button
Figure 2 - Click the plus (+) button under Linked Frameworks and Libraries.
  1. In the Choose Frameworks and Libraries window, scroll down, select CoreData.framework, and then click the Add button (Figure 3) to add the framework to the project;
Add Core Data
Figure 3 - Add CoreData.framework to the project.
  1. This adds CoreData.framework to the Frameworks group (Figure 4);
Core Data Framework added
Figure 4 - Move CoreData.framework to the Frameworks group.
  1. Now let's add a Business Layer group to the Project Navigator, which will be used to store the entity data model, and eventually, the entity classes and other business layer classes. To do this, right-click the iAppsReview group folder in the Project Navigator, and then select New Group from the shortcut menu. This adds a new group to the Project Navigator (Figure 5);
Add a new group
Figure 5 - Add a new group in the Project Navigator
  1. Next, enter the text Business Layer to specify the name of the new group and press return;
  1. Now let's add an entity data model to the new Business Layer group. To do this, right-click the Business Layer group and select New File... from the popup menu;
     
  2. On the left side of the New File dialog under the iOS section, select Core Data, and then on the right side of the dialog, select the Data Model template as shown in Figure 6;
Add a Data Model
Figure 6 - Add a Data Model to the project.
 
  1. Click the Next button to display the Save dialog. Change the name of the new file to iAppsReview.xcdatamodeld.
  1. Click the Create button to add the new entity data model to the project. In the Project Navigator, select the iAppsReview.xcdaamodeld file and the new entity data model is displayed in the Xcode editor region (Figure 7);
New Entity Data Model
Figure 7 - The new entity data model

Designing Entities in the Data Model

By default, there are no entities included in the entity data model. In the toolbar at the bottom of the entity data model (Figure 7) is an Add Entity button that allows you to add new entities to the model. There is also an Add Attribute button that allows you to add attributes to the currently selected entity (the button is disabled if no entity is selected).

There is also an Editor Style button group that allows you to switch between Table and Graph styles. After we add some entities, I'll show you the difference between these two viewing styles.

Adding Entities to the Model

In our quest to turn iAppsReview into a working app, we will add a ReviewEntity to the model, which represents the reviews written by users. By way of reminder, Figure 8 contains the Write Review scene that shows the information we are capturing from the user for each review.

Write Review scene
Figure 8 - The Write Review scene shows the information we are capturing for reviews.

Follow these steps to create a ReviewEntity in the data model:

  1. With the entity data model selected in the Project Navigator, and the Entity Data Model Editor open in the design surface, click the Add Entity button at the bottom left of the entity data model. This adds a new entity under the Entities section in the panel on the left as shown in Figure 9;
Add Entity to Model
Figure 9 - Add a new entity to the entity data model.
  1. The Data Model inspector is automatically displayed for you on the right side of the Xcode window as shown in Figure 10. If you don't see the Data Model Inspector, you can display it by selecting View > Utilities > Show Data Model Inspector from the Xcode menu. Change the name of the entity from Entity to ReviewEntity and press return;
Data Model Inspector
Figure 10 - The Data Model Inspector
  1. In the Data Model Inspector, set the Class to ReviewEntity. This specifies the name of the class that will later be generated from this entity;
  1. Now let's add an attribute to the ReviewEntity. To do this, click the Add button at the bottom of the entity data model. This adds an attribute in the Attributes section of the currently selected entity (Figure 11).
Add an attribute
Figure 11 - The newly added attribute

Although you can change the name and type of the attribute directly in the model, I find it easier to set this information in the Data Model Inspector as shown in Figure 12. As you can see, it contains different settings when an entity's attribute is selected in the Data Model Editor.

Data Model Inspector for attributes
Figure 12 - The Data Model Inspector for attributes

Entity Attribute Settings

Let's take a brief detour to explain each of the entity attribute settings.

  • Name - The name of the entity attribute. This should be camel cased (first letter lowercased and then the first letter of each word in a compound word is uppercased) since Xcode will generate a property on an entity class from this attribute.
  • Transient - When this option is selected, it indicates that the attribute value is generated at run time rather than retrieved and stored to the database. For an example of using transient attributes, see this link.
  • Optional - When this option is selected, it indicates the attribute is not required to have a value. For example, in an Address entity, you may specify that an address2 attribute is optional, since most addresses don't have a second address line.
  • Indexed - Specifies if the corresponding database column is indexed. You should typically select this option for columns on which you need to perform searches. For more information on database indexes, check out this link.
  • Attribute Type - Specifies the type of values the attribute holds. Some of the most common options are Integer16, Integer32, Decimal, String, Boolean, and Date.

If you select one or more numeric attribute types, you see additional Validation settings where you can specify the Minimum, Maximum, and Default values.

If you select the String attribute type, you see additional settings such as Min Length, Max Length, and Default value.

Creating ReviewEntity Attributes

Now that you have an understanding of the various attribute settings, it's time to add attributes to the ReviewEntity.

  1. Select the iAppsReview entity data model in the Project Navigator.
  1. In the Entity Data Model Editor, make sure the ReviewEntity is selected in the left panel, and select the attribute you added earlier in this post (Figure 13).
Select the ReviewEntity attribute
Figure 13 - Select the ReviewEntityattribute.
  1. In the Data Model's Inspector, set the following attributes as shown in Figure 14.
appName attribute settings
Figure 14 - The address attribute's settings
  • Set the Name to appName, and press return.
  • Uncheck the Optional check box.
  • Set the Attribute Type to String.
  1. Let's add more attributes to ReviewEntity. When you're finished, the entity attributes in the Data Model Editor will look like Figure 15.
ReviewEntity attributes
Figure 15 - ReviewEntity attributes

To add the attributes shown in Figure 15, first click the New Attribute button at the bottom of the Data Model Editor, then set the specified name and attribute type. Uncheck the Optional check box for all attributes except image, and isPosted, since these attributes are optional. 

  1. As a final step, select the rating attribute, and then go to the Data Inspector and set the Minimum to 1, and the Maximum to 5 (doing this automatically selects the Minimum and Maximum check boxes). This sets up what we call business rules. We are specifying that the user must enter a rating of at least 1 and no more than 5.

Creating the AppCategoryEntity

As a reminder of how we are using app categories, you can see in Figure 16 that tapping the App Category cell at the top of the Write Review scene takes the user to the App Category scene where they can select a category for the app. Currently, this iist of categories is hard-coded in our prototype app. However, we want to change the app to display a dynamic list of app categories that we can add to in the future as needed. 

App Category Scene
Figure 16 - You can select a category from the App Category scene.

To make this happen, we need to create an AppCategoryEntity that can be used to represent the different app categories shown in the App Category scene.

  1. At the bottom of the Data Model Editor, click the Add Entity button to add a new entity to the model.
  1. In the Data Model Inspector on the right side of the Xcode window, change the name of the new entity to AppCategoryEntity and then press return.
  1. Next, change the Class to AppCategoryEntity. Again, this specifies the name of the class that will later be generated from this entity.
  1. This entity only has two attributes, so it's very easy to add. With the AppCategoryEntity still selected, click the Add Attribute button. Afterwards, go to the Data Model Inspector and set the following properties:
  • Set the Name to categoryID.
  • Uncheck the Optional check box.
  • Set the Attribute Type to Integer32.
  1. To add the second attribute, click the Add Attribute button again. Afterwards, go to the Data Model Inspector and set the following properties:
  • Set the Name to name.
  • Uncheck the Optional check box.
  • Set the Attribute Type to String.

When you're finished, the Data Model Editor should look like Figure 17.

AppCategoryEntity attributes
Figure 17 - AppCategoryEntity attributes

The name attribute contains the descirption of the category as shown in the App Category scene's list, and the categoryID attribute contains an integer value that uniquely identifies each app category. Often, you can let Core Data generate these unique integer values automatically by using entity relationships as I used in the entity data model in my previous post. When we discuss entity relationships in an upcoming post, I'll explain why I've created this attribute manually.

Creating the UserEntity

Now we need to create our final entity, the UserEntity. This entity is used to model users of our app.

  1. At the bottom of the Data Model Editor, click the Add Entity button to add a new entity to the model;
  1. In the Data Model Inspector on the right side of the Xcode window, change the name of the new entity to UserEntity and then press return;
  1. Next, go to the Data Model Inspector and change the Class to UserEntity;
  1. Now add the attributes with the specified name and data type shown in Figure 18 and as you do, uncheck the Optional setting for each attribute. 
UserEntity attributes
Figure 18 - UserEntity attributes

Data Model Editor Styles

Up to this point, we have done all of our work viewing the editor in its Table style. Now that there are three entities on the model, it's a good time to view the model in Graph style. To do this, click the right button in the Editor Style button group at the bottom of the Data Model Editor. When you do this, you will see the three entities overlayed on top of each other. I recommend dragging the entities on the model so they are positioned as shown in Figure 19.

Graph style
Figure 19 - The Entity Data Model viewed in Graph style

Congratulations! You have created your first entity data model!

Conclusion

In this blog, you learned a lot about modeling entities for your iOS apps. In my next blog post I will show you how to generate Objective-C classes from these entities and use them within the app!

<<Previous         Next>>

Tip of the Day: How to Restrict Access to Adult Websites

$
0
0

If your children have an iPad or iPhone, you may want to restrict which websites they can visit. There are two options for doing this. You can set the website restrictions to only allow access to a list of preselected websites, which is ideal for very young children. For older children, you can restrict access to to adult content and designate specific websites as always allowed or or never allowed.

Go to Settings>General>Restrictions.

Tap Enable Restrictions. You will be required to set a passcode. Make sure you choose a code you will remember and that your children won't be able to figure out.

Scroll down and tap Websites.

Select Specific Websites Only if you only want to allow your children access to preselected websites. Add additional websites to the list by tapping Add a Website and typing in the complete URL.

Select Limit Adult Content if you want to prevent your child from accidentally clicking on a link leading to inappropriate content. If there is a site your child has permission to visit that the restrictions mistake for adult content, you can tap Always Allow and type in the URL. If there is a site the restrictions don't prevent your child from accessing, you can tap Never Allow and type in the URL for that site.

 

Yes, You Can Take Great Photos With an iPad, Especially With the olloclip

$
0
0

At CE Week, olloclip, the makers of the original clip-on set of camera lenses for the iPhone, showed off a version for the iPad Air and iPad mini. While some frown upon taking photos with a tablet, olloclip has embraced the phenomenon, even creating a funny and useful pamphlet on the subject entitled "iPad Photography: An Etiquette Guide."

iPad photography etiquette

Sure, the iPad's camera isn't has powerful as the iPhone, but it's good and with the olloclip's optional lenses, it's even better. Perhaps more importantly, an iPad can be a better viewing and editing device than an iPhone. If you want to manipulate those photos or create polished movies, you have more options on an iPad. So if they are recorded on the tablet, there are no transfer hassles.

Not all iPads are supported, as the olloclip for iPad only works with the iPad Air and both the Retina and original iPad minis. You need a snug fit and those devices are the appropriate thickness so the lens lines up just right. In a way, the iPad could be a better solution than an iPhone because there's no flash to get in the way of the Olloclip, as there is with the iPhone.

olloclip provides four lenses with the iPad model, namely two macro lenses (10x and 15x), a Fisheye lens and Wide Angle lens. You can use your favorite video and photo apps and then share your creations on their gallery. It's quite an impressive array, and maybe your photos will make the grade!

Kanex Dock Makes Any Mac Desktop More Organized

$
0
0

My Macbook has a bunch of wires plugged in at any time: Lightning cables, USB hard drives, Ethernet, video and more. I'm always looking for anything that makes it easier to disconnect so I can take my laptop and work somewhere else. Plus, when the Macbook comes back to its home, it's nice to have an uncluttered desk.  
Kanex has a reasonable solution. Unlike expensive Thunderbolt-based hubs or proprietary docking stations that only work with a particular MacBook model, the Kanex simpleDock uses a single USB 3.0 connection to the MacBook and delivers multiple USB ports, Ethernet, and more! In a shift from Kanex' typical white or black plastic offerings, their simpleDock uses solid aluminum and looks like it came from Apple. It's a perfect complement to any MacBook.

Because it doesn't use Thunderbolt, it's more affordable ($120 compared to $200 to $300) as it doesn't try to do too much. You still connect your displays directly to the MacBook, but hard drives, phone cables, and other USB devices are now connected via the Kanex simpleDock, and USB 3.0 means the speeds aren't an issue. Your one USB 3.0 port on a MacBook now becomes three USB 3.0 ports plus a USB 2.0 port suitable for an iPhone, and an Ethernet port, via built-in USB to Ethernet. So by connecting that one USB cable, you can have a wired network connection as well as connections to other high speed devices.
simpleDock 
The simpleDock even has a 'valet' stand for an iPhone to rest, and the iPhone cable can be routed conveniently through the dock. This helps eliminate the spaghetti wiring that plagues too many desktops. The best part is that the simpleDock will last as you change computers, making it an event better investment!


You Can Now Upgrade iPod Storage for Less

$
0
0

In a long overdue move, Apple dropped the prices on the iPod touch, particularly for the higher storage capacity versions. Now users can get the current generation of the iPod touch in a 16GB version for $199, and for just $50 more they can upgrade to 32GB and for $100 more to 64GB. That entry level 16GB model now includes a decent camera and is available in many colors. The older model can be snagged for $149 at Apple's clearance/refurbished store.

For the longest time, Apple separated these storage capacities by $100. Even with the cost of storage dropping consistently, Apple has maintained those price tiers since 2007. This price disparity is often disparaged by Android supporters, as they can usually add cheap microSD cards to boost storage. Apple is unlikely to go that route, so this pricing move makes it easier to purchase a higher capacity device from the start.

With a new iPhone expected in three months, it will be interesting to see if this pricing strategy is carried over to iPhones and iPads. As camera resolutions increase, videos and photos take more room. Retina displays are now the norm, so apps use more space for higher resolution images. A 16GB model doesn't cut it these days. I have a 32GB iPad Air and I'm constantly running out of space. More storage for less money would be very welcome.

 

Unleash Your Inner App Developer Part 16: Tuning Up Core Data

$
0
0

Do you have an idea for an app but lack the programming knowledge to begin building it? In this weekly blog series, How to Unleash Your Inner App Developer, I will take you, the non-programmer, step by step through the process of creating apps for the iPhone, iPod touch, and iPad. Join me each week on this adventure, and you will experience how much fun turning your ideas into reality can be! This is Part 16 of the series. If you are just getting started now, check out the beginning of the series here(This post has been updated to iOS 7.1.)

In my previous blog post, you learned how to add Core Data to a project and how to design entities in a data model. In this post, you will learn how to generate entity classes from the entities in a data model and use them within your app. You can get the latest version of the iAppsReview project at this link.

Generating Entity Classes

It's important to note that an entity on a data model is not an actual Objective-C class. You need to take an extra step to generate a class from an entity on a data model as outlined in the following steps:

  1. Open the iAppsReview project in Xcode;
  1. Select the iAppsReview.xcdatamodeld entity data model in the Project Navigator. You can view the model in either Table or Graph style;
  1. Press Command+N (hold the Command key down and then press the N key) to add a new file to the project;
  1. On the left side of the New File window under iOS, select Core Data and on the right side of the window select NSManagedObject subclass (Figure 1);
New File window
Figure 1 - Select the NSManagedObject subclass file template.
  1. Click the Next button. The next page of the window should display the entity data model with a check mark next to it (Figure 2). 
Select the data model
Figure 2 - Select the data model.
  1. Click the Next button. In the next page of the window all three entities in the entity data model are listed. Click the check box next to each of the three entities to select them as shown in Figure 3;
Figure 3 - Select all of the entities.
  1. Click the Next button to display the Save File window. Select the Use scalar properties for primitive data types check box (Figure 4). When this option is selected, Xcode, generates properties for your entities that are scalar types (such as float, double, and so on). If this option is not selected, Xcode generates properties of the type NSNumber instead. There is no right or wrong choice for this check box. I personally prefer to work with the scalar properties because it typically requires less code to work with them;
Save File dialog
Figure 4 - Select Use scalar properties for primitive data types.
  1. Click the Create button. This adds the new entity class files to the Project Navigator shown in Figure 5.
New entity files
Figure 5 - The new entity class files

Let's take a closer look at the generated class files. In the Project Navigator, select the ReviewEntity.h file and you will see the code shown in Figure 6.

ReviewEntity header file
Figure 6 - The ReviewEntity header file

In this code, an Objective-C property has been generated for every attribute in ReviewEntity on the entity data model (for a discussion of properties, check out this earlier post in the series.) The @interface declaration indicates that the ReviewEntity class is a subclass of the NSManagedObject class just as you specified when generating the entities as shown in Figure 1.

Now select the ReviewEntity.m file in the Project Navigator, and you will see the code shown in Figure 7.

ReviewEntity implementation file
Figure 7 - The ReviewEntity implementation file

The @dynamic declarations tells the compiler that the full implementation of the properties will be generated dynamically at run time. This dynamic implementation occurs because the entity is a subclass of NSManagedObject.

Feel free to examine the UserEntity and ReviewEntity class files to see the properties that have been generated for these entities.

Retrieving Entities

There are several steps involved in retrieving entities from a data store. Figure 8 contains a code block that shows a typical example of these steps.

Fetch Entities code
Figure 8 - It takes quite a bit of code to retrieve entities from a data store!

This code is definitely not trivial. Don't panic—I'll provide a much easier way for you to retrieve entities without writing all of this code, but here's an explanation of each step:

  1. Create the request object - This code creates an instance of NSFetchRequest. The request object is configured in the next few steps and then passed to the object context to be executed;
  1. Set the entity type to be fetched - This code may look complex, but all it does is configure the request object with the type of the entity to be retrieved (in this case, ReviewEntity);
  1. Set the predicate - This code specifies a filter, or search criteria that returns a subset of entities in the database. In this example, only ReviewEntity objects from a specified category are retrived. This step is optional if you want to retrieve all entities;
  1. Set the sort descriptor - This code specifies the sort order of entities retrieved from the data store. In this example, entities are sorted by appName. You can skip this step if you don't need the entities to be sorted;
  1. Execute the fetch - This code sends an executeFetchRequest: message to the object context, passing the request object. The entities returned from the object context are stored in an NSMutableArray, which is a collection that is mutable, or changeable;
  1. Check for errors - If an error occurs at this level, it's usually because you have set something up incorrectly in the database (versus an actual database error).

Creating New Entities

Unlike most other Objective-C classes, you don't create an instance of a Core Data entity by using alloc and init messages. To create a new Core Data entity, you can pass an insertNewObjectForEntityForName:inManagedObjectContext: message to the NSEntityDescription class as shown in the example in Figure 9.

Create a new entity
Figure 9 - Creating a new ReviewEntity object

In this message call, you pass the class of the entity you want to create, as well as a reference to the object context with which the new entity is to be associated.

Deleting Entities

Deleting a Core Data entity is pretty straightforward. All you have to do is send the object context a deleteObject: message, passing the entity to be deleted as shown in Figure 10.

Delete an entity
Figure 10 - Deleting an entity object

Passing the deleteObject: message doesn't immediately delete the entity from the data store—it simply marks the entity for deletion. Entities that are marked for deletion are physically removed from the data store the next time the object context is asked to save changes to entities.

Saving Entities

To save all of the changes to entities that have been created and retrieved from a particular object context, you send the object context a save: message as shown in the example in Figure 11.

Save an entity
Figure 11 - Saving changes to entities

This code first sends a hasChanges: message to the object context (there is no need to save changes if there are no changes to save.) If the object context has changes, the code sends a save: message to the object context. The object context returns YES if the save succeeded and NO if it failed. The if statement checks if the result is NO, and if it is, logs an error to the Console. Again, if you have an error at this level, it's most likely because of a setup issue versus a true database error.

mmBusinessObject to the Rescue!

When you first see the code you need to write to retrieve and manipulate entities in Core Data, it can be a bit daunting to say the least. After writing that same code a number of times, you start thinking "there's got to be an easier way." This is where the mmBusinessObject class comes in. This is a custom class I have created for you that makes using Core Data much easier.

The mmBusinessObject class doesn't replace Core Data. It simply provides a "wrapper" around the Core Data classes that makes them easier to use, and allows you to write less code when you want to create, retrieve, update, and delete entities.

As shown in Figure 12, mmBusinessObject can be used as the superclass of all the business controller classes in your project. As discussed in my previous blog post, your business controller classes can contain all of the code in your app that retrieves and updates entities. For example, all of the code that retrieves and updates ReviewEntity objects can be placed in a Review business controller. All the code that retrieves and updates AppCategoryEntity objects can be placed in an AppCategory business controller, and so on.

Business controller hierarchy
Figure 12 - mmBusinessObject can be used as the superclass of all your business controller classes.

I have included the mmBusinessObject class in the iAppsReview project code for this post. Let's take a close look at mmBusinessObject to see how it works.

mmBusinessObject Properties

If it's not already open, in Xcode, open the iAppsReview project. In the Project Navigator, select the mmBusinessObject.h header file and you will see the instance variables and properties declared near the top of the file as shown in Figure 13.

mmBusinessObject properties
Figure 13 - mmBusinessObject instance variables and properties

As you can see, mmBusinessObject has these three properties that hold a reference to the key Core Data objects I discussed in part 14 of this series:

  • managedObjectContext
  • managedObjectModel
  • persistentStoreCoordinator

Since these properties are on the mmBusinessObject class, when you create business controller subclasses of this class (such as the Review, AppCategory, and Shipment business controllers shown in Figure 11), they inherit these properties and therefore each have their own object context and associated Core Data objects. This means that each business controller can retrieve and update entities without affecting other business controllers!

As you will see later in this series, there are times when you want business controllers to share the same object context, and this is very easy to do.

The entityClassName property allows you to specify the name of the entity class associated with a particular business controller class. That way you don't have to keep specifying the name of the business entity class every time you want to create, retrieve, update, or delete an entity.

The dbName property provides a place to specify the name of the database with which you are working. Since most apps typically use just one database, it makes sense to specify this in one place in your app, rather than specifying it in each of your business controllers. The easiest way to do this is to create an ABusinessObject class that sits in the hierarchy between mmBusinessObject and your app's business controller classes as shown in Figure 14

ABusinessObject hierarchy
Figure 14 - The ABusinessObject class is a great place to specify your app's database name.

I have added an ABusinessObject class to the iAppsReview project. If you click on the ABusinessObject.h file in the Project Navigator, you can see that ABusinessObject is a subclass of mmBusinessObject as shown in Figure 15.

ABusinessObject header
Figure 15 - ABusinessObject is a subclass of mmBusinessObject.

If you select the ABusinessObject.m file in the Project Navigator, you can see that within the init method, the dbName property is set to iAppsReview as shown in Figure 16. Since there is only one database for this app, this is the only place where the database name needs to be specified.

ABusinessObject implementation
Figure 16 - The dbName property is set to "iAppsReview".

mmBusinessObject Methods

Now let's take a closer look at the methods of the mmBusinessObject class. If you look a little further down in the mmBusinessObject.h header file, you will see the methods shown in Figure 17 that allow you to create, delete, retrieve, and update entities.

mmBusinessObject methods
Figure 17 - mmBusinessObject methods

You will learn more about these methods as you use them in upcoming posts in this series. However, if you want to take a quick look at the implementation of the methods in mmBusinessObject.m, you will find they simply contain the standard Core Data code you saw earlier in this post.

Conclusion

mmBusinessObject is a good example of something you should do in all of your apps. When you find that you are writing the same code over and over again, you should create a new class with methods that contain the redundant code. In doing this, you are creating your own custom application framework that can be reused in many different iOS projects.

At this point, the project is ready for us to create our custom business controller classes that we will use in iAppsReview. In next week's post, we'll create these custom business controller classes in the project and examine the associated SQlite database.

<<Previous         Next>>

Hengedock has a place for everything

$
0
0

I'm on a train back from CE Week, blogging by iPad with a compact Bluetooth keyboard. While it's convenient to travel light, I will be glad to get back to my 15-inch MacBook Pro with Retina display. In fact, I won't be using that Retina display all that much, because I now have my MacBook hooked up to a pair of 24-inch monitors and the MacBook is tucked away in the new Hengedock docking station.

A Hengedock routes all the main cables from a MacBook into a docking station that makes it easy to grab the laptop and go. It works well for many MacBooks, since they have most of their ports on the left side. By lining up the cables just so, they can be plugged and unplugged relatively easily. It's almost as if Apple had the Hengedock in mind when designing their computers. But that's a testament to Hengedock reverse engineering what was needed to make such a dock.

I've been a customer of Hengedock since their early models, which were in such demand that I had to spend months on a waiting list. This wasn't a preorder situation, but just a problem meeting demand. Those docking stations, while not perfect, made it easy to set your laptop aside and use a full-size keyboard, mouse, trackpad, monitor etc., and then when you needed portability, you could just pull the computer out of the dock, similar to what you would now do with an iPad or iPhone.

As I mentioned, those early units were not perfect. They were made of plastic and didn't always stay put. I artificially weighed mine down to keep it in line. The cables had to be installed manually, then tightened with a tiny wrench, which felt like a game of Operation. Trial and error was required until they were just right.

hengedock

Now, the new generation of Hengedocks is here. The cables come pre-installed (hooray!) and the base is made of solid aluminum so it should stay put. It's elegant and a worthy companion for a MacBook. They include almost all the cables you might need, except a MagSafe charger. But that's because of Apple's patents. You can bring your own, and they even include adaptors because of the different generations of MagSafe connectors. While miniDisplayPort cables are included and installed, if you want to use Thunderbolt, you will have to resort to the manual installation method, and provide your own expensive cables!

The downside to the Hengedock solution is that it requires a specific dock for each type and size of MacBook. I just traded in my original 15-inch MacBook Pro with Retina display to SellYourMac.com. I purchased the same model, but with three times the disk space and twice the RAM, so for me, the Hengedock's model-specific nature hasn't been a problem. But if Apple changes the placement of ports in a future MacBook Pro, or I if want a MacBook Air, it would require a different Hengedock. Fortunately they're not as pricey as some of their competitors, so I can deal with it. And I could always sell the Hengedock with the MacBook, when I upgrade. Or I may keep the MacBook Pro for the kids and they can leverage the Hengedock.

hengedock

Another consideration is that I paid extra for that Retina display and with the MacBook closed up and mounted vertically, I don't see it. Still, my dual 24-inch screens make up for that, and of course I get to use the Retina display while mobile. But Hengedock has thought of this and preannounced a horizontal model, that lets you continue to use the MacBook keyboard, trackpad, and screen while docked, along with external displays and devices. This, combined with their heavy duty Lightning dock, which I've reviewed already, are part of Hengedock's efforts to take over your desktop! Fortunately, with the shift to beautiful aluminum docks, I don't mind!

hengedock

Use SimplePi to control and Monitor Your Raspberry!

$
0
0

I'm always scanning for unique and hackable tech, and a news item caught my attention about an app called SimplePi ($1.99) for managing a Raspberry Pi from your iDevice. Since I have been eyeballing similarly geeky tech (for file sharing, etc.), I had to check it out. If you are a Raspberry Pi aficionado, and looking for a nice app experience to help you manage your Pi, today is your lucky day. Not sure what I'm talking about? Read on to learn how a Pi could help round up your stray media!

I geeked out a bit this past Father's Day when my kids bought me a Cirago NUS1000 for around $40 on Amazon. I was looking for a lightweight Linux gadget to share hard drives and a printer on my network, and though I was seriously going to go for a Pi, the NUS fit the bill, bringing media services and webdav connectivity along for the ride and only a minor setup effort. Now I can access files on my old hard drives from anywhere and from anything (even my Apple toys). But I digress... I was recently able to play with someone's Pi remotely (which admittedly sounds weird). The developer of SimplePi allowed me to connect to his XBMC-enabled Pi server. What's a Pi, you ask (or an XBMC for that matter)? Well, I was just getting to that.

You might be one of the those uber-cool Apple-connected people that should they desire a new media server for their home network, simply bellies up to the Genius Bar for an Apple TV. Perfectly understandable and not a bad choice. You bring it home, read a two-to-three step quick-start guide, and voila, you are streaming away Game of Thrones like a fiend (presuming you are tied into Apple's ecosystem, which you probably are). But what if I said you could exert a little more control over your media serving destiny?

You could buy a credit card sized computer circuit board with basic I/O, CPU, memory and peripheral device ports called a Raspberry Pi that sips power. You could then flash some pre-programmed software or build in your own custom hacks, and in like a few hours (or days or weeks depending on the scale of your geeky prowess) have your own totally bad-butted media server! Or maybe a Christmas light controller (what one of my colleagues is planning)! How about a zombie-killing-robot control module? The Pi puts all of these possibilities and more literally in the palm of you hand. But here is the catch. You have to work a little for it. You may have to run some command line commands for example, or learn a bit of code. Or, perish the thought, troubleshoot an SD disk mount problem. If you want to buy a practically ready-made XBMC/Pi media server, you can go that direction too. Wait, I still haven't explained about XBMC, have I?

XBMC is an open-source media player with software plug-ins and add-ons that can make it a powerhouse media center. A media center is really what Apple TV mostly is, though one that Apple tightly controls. A media center serves up content to your network attached devices, be they computer, smartphone, or tablet. I use XBMC on my computer to play DVDs, because Windows 8 can't, for example. I can also now use it to browse all the content shared out from the NUC1000 my kids gave me. 

SimplePi let's you browse your media folders on your Pi media center..

An XBMC-shared system can include TV shows you have downloaded or on-demand content from the interwebs (through plug-ins), but the point is that your center (that you own and control) is doing the heavy lifting. If you already have movies and music stored on an external hard drive (and likely in a mix of formats), then XBMC-Pi could be a liberating choice for you, without tying your cart to Apple too tightly. Now you see the full picture, pun intended. Well then, what does SimplePi have to do with anything? Good question.

Pi is a minimalist piece of hardware made to be tinkered with. If you buy this thing at Fryes or online, what you pull out of the package (even with an XBMC bundle) might look like it fell out of the guts of C-3PO. It likes a little care and feeding, and since you are its new Daddy, it's your job. You might take a notion to try your hand at running some basic scripts or commands. Maybe do something insane like back up your Pi with a Cron job or something (which is possible and desirable if you just spent two days programming it). Simple Pi is the answer you were looking for.

Once you input the connection information into SimplePi to control and monitor your Pi, the rest is academic. If all you wanted to do was sit and watch the undulating graph of your Pi controller, memory and disk activity, then enjoy! However, maybe you want to run a few commands, or (heaven forbid) execute a reboot! The Pi app gives you some generic control commands (shut, restart, etc.), and you can create your own custom ones too. An annoyance or two here for a paid app: You can't view commands that produce output to standard out (meaning the console shell, because there is no interactive shell) though you can redirect to a file. The app uses SSH, and to use a key pair (instead of password) requires some goofing around with emailing the keys, but the programmer is looking into these items for future updates, and he does offer a full SSH app if you prefer to go that route.

To demonstrate the custom commands I configured a few that redirected to text files (which can then be viewed in the in-app file explorer). The command output probably looks like gobbledygook if you aren't familiar with basic Linux. One command is a process list or ps that filters for any xbmc processes, and another a unix list command (with options to list all files at root with a long listing, and to sort by reverse order).

The overall app is well done and responsive. It also only crashed a couple of times (which could have honestly been the Pi itself locking up). You could add a whole army of Pi nodes here and get a quick view of them, monitor the temp, CPU clock speed, etc  on each. For multiple Pi monitoring it would be a nice addition to allow dockable views of each Pi in a tabbed format. Any Linux host that presumably has SSH enabled should mostly work with SimplePi, but I did not verify that.

Verdict

SimplePi does exactly what it says it does: monitor and control one or more Raspberry Pi devices from your iPad or iPhone. I give a hearty hacking seal of approval and recommend it to any and all Pi lovers who may have the need to keep a remote eye on their little computing pets. For $1.99 I might want a few extra skins to choose from (instead of just black), but that's just me. Grab the app at the links above, and to learn more or get your own Pi, go here.

Tip of the Day: How to Clear Cookies and Browsing History from Safari

$
0
0

Whenever you browse the web in Safari, your iPhone or iPad logs the sites you visit, which allows you to easily go back and visit those sites again. Your iPhone and iPad also store cookies and other data, which is what allows you to revisit sites without having to log in each time. 

For privacy reasons, or just as part of basic housekeeping, you may want to occasionally clear this data from your iDevice. 

Go to Settings>Safari and then scroll down and tap Clear History. Verify that this is what you want to do and then repeat for Clear Cookies and Data.

  

If you don't want the sites you visit in the future to appear in your history or to be tracked by cookies, use private browsing in Safari.

 

Top image credit: sergign/Shutterstock.com

Apple News: Glass or Sapphire to Grace Back of the iPhone 6?

$
0
0

There is no shortage of rumors, mockups, spy shots, and speculation as we head into the last couple of months before the iPhone 6 is announced. Most of the alleged photos of the device show a metal back, but now rumors from France and Japan, via Apple Insider, suggest the metal strips at the top and bottom are only placeholders. That area will be covered in glass, similar to the current iPhone 5s, when the iPhone 6 ships.

iPhone 6

This makes sense, because Apple needs a way for the internal radios to get out to the world, and metal acts as a shield. Apple doesn't want a repeat of "AntennaGate" so you can be sure they are thinking about how to combine functionality and aesthetics. While glass is the obvious choice, since the iPhone 5s uses it, Apple may be planning to put their new Sapphire manufacturing plant to work on this.

The rumored iWatch could get a lot of banging and bumping, making the more durable sapphire the logical choice for its screen, but the small strips where the iPhone 6's radios are located could also benefit from such a screen. I see a lot of broken iPhones in my travels and anything Apple can do to make them more robust would be appreciated. Whether Apple goes with glass, sapphire, or sticks with metal for the back of the iPhone 6, one thing is sure, we should find out soon!

See it, Buy it: Finding Fashion with ASAP54

$
0
0

How many times have you spotted someone impeccably dressed on the streets of New York, or any stylish city for that matter, and wondered where they snagged their amazing blouse or those undeniably chic flats? Would you flat-out ask the savvy individual where they shop, or would you let the moment pass by and hopelessly yearn for something that will never be? Well wonder no more. Thanks toASAP54 (Free), the latest fashion-finding app to hit the scene, you never have to miss out on a major fashion moment again.

 

ASAP54 logo.

Here’s the scoop, ASAP54 has been dubbed “the new way to discover and shop fashion online,” and for good reason. The app utilizes the camera on your iPhone or iPad to take a snapshot of whatever must-have clothing item or head-to-toe look you’re currently eyeing and instantly locate similar products from around the web. Like so many social media apps, you have the option to follow other like-minded fashion ASAPERS for daily inspiration. For those rare instances when you're unhappy with ASAP54's return search items, there’s a stylist on hand who will get back to you within 24 hours with 5 more fine-tuned looks.

ASAP54 seamlessly lets you capture a photo, crop it to best fit the targeted item, select your gender and the appropriate category (i.e. shirt, dress, shoes), and voila, the item that you’re coveting is only a few taps away. One great feature is the option to further refine your search by typing in keywords, brands, stores, price range, and color. I found this to be very convenient as not all of us want the results to only yield dresses that cost $1000 or more.

Olivia Palermo on ASAP54.

 

Pros:

  • Very easy to use. Upon downloading the app, learning to use it was pretty self-explanatory.  
  • Aesthetically pleasing. The results seamlessly load onto the screen of your iPhone/iPad in a Pinterest-like manner.
  • Innovative and highly interesting concept for the iPhone generation. While there are apps and websites like ShopStyle or Polyvore that allow you type in the description of a clothing item you’re trying to hunt down, ASAP54 takes it a step further thanks to its visual recognition technology.  
  • There are over 150 retailers and 1 million products available in the ASAP54 database.

Cons:

  • When taking photos to upload, lighting is everything. To ensure the products that ASAP54 is fetching are relevant to your search interests, the quality of your photo is imperative.
  • Depending on the item, sometimes the items retrieved look nothing like what you’ve snapped. To be fair though, ASAP54 does compensate for this flaw by having live stylists on hand for assistance.
  • ASAP54 could benefit from having more celebrities and fashion bloggers join the community. It would be awesome to see which outfits and trends they’re snapping as opposed to average users.

Verdict

ASAP54 is an undeniably cool fashion app that has unlimited potential. As a self-proclaimed fashion girl, I strongly recommend giving it a download. All in all, this app is more than deserving of the 4 out of 5 stars that I’m giving it.  

 

Unleash Your Inner App Developer Part 17: Core Data Test Drive

$
0
0

Do you have an idea for an app but lack the programming knowledge to begin building it? In this weekly blog series, I will take you, the non-programmer, step by step through the process of creating apps for the iPhone, iPod touch, and iPad. Join me each week on this adventure, and you will experience how much fun turning your ideas into reality can be! This is Part 17 of the series. If you are just getting started now, check out the beginning of the series here(This post has been updated to iOS 7.1.)

In my previous post, you learned how to generate Objective-C classes from entities in a data model and you were introduced to the mmBusinessObject class, which provides an easy-to-use wrapper for Core Data classes. In this week's post, we're going to create our app's custom business controllers and take them for a test drive!

In order to perform the steps outlined in this post, you can get the latest version of the iAppsReview project at this link. I recommend following the steps in this post yourself, but if you get stuck, you can get the finished app at this link.

Creating Business Controllers

By way of reminder, Figure 1 shows the three business controllers we need to create for the app, and all three will be subclasses of the ABusinessObject class.

Business controller classes
Figure 1 - The business controller classes are subclasses of ABusinessObject.

Creating the Review Business Controller

First, let's create a Review business controller object.

  1. Open the iAppsReview project in Xcode;
  1. In the Project Navigator, right click the AppCategoryEntity.m file (so the new files are added directly below AppCategoryEntity.m), and select New File... from the popup menu;
  1. On the left side of the New File dialog under the iOS section, select Cocoa Touch. On the right side of the dialog, select the Objective-C class template, and then click the Next button (Figure 2);
Create a new class
Figure 2 - Create a new Objective-C class.
  1. In the next step of the dialog, set the Class to Review and set Subclass of to ABusinessObject as shown in Figure 3;
Create Review class
Figure 3 - Create a Review class subclassed from ABusinessObject.
  1. Click the Next button to launch the Save File dialog. Click the Create button, which adds the new Review classes to the Project Navigator as shown in Figure 4;
New review class files
Figure 4 - The newly added Review class files
  1. Now let's add an init method to the Review class that allows us to specify the name of the associated entity class.

In the Project Navigator, select the Review.m file and add an empty line between the @implementation and @end declarations;

  1. Type the init keyword to bring up the Code Completion popup (Figure 5);
The init Code Completion popup
Figure 5 - The init Code Completion popup
  1. Press return to add the init code template to the file as shown in Figure 6;
Figure 6 - The init code template
  1. Replace the statements placeholder with the code shown in Figure 7 (you can just start typing to replace it).
Set entityClassName
Figure 7 - Set the entityClassName property.

This code sets ReviewEntity as the default entity class associated with the business controller. This allows you to avoid typing the entity class name every time you want to create, retrieve, update, or delete a ReviewEntity.

Creating the AppCategory Business Controller

Now let's create an AppCategory business controller. The instructions are very similar to those in the previous section, so I'll abbreviate them a bit. 

  1. Right-click the iAppsReview.xcdatamodeld file in the Project Navigator (so the new files are added directly below it), and select New File... from the popup menu;
  1. On the left side of the New File dialog under the iOS section, select Cocoa Touch. On the right side of the dialog, select the Objective-C class template, and then click the Next button;
  1. In the next step of the dialog, set the Class to AppCategory and set Subclass of to ABusinessObject (it should already default to ABusinessObject since this dialog remembers the last value you specified);
  1. Click the Next button to launch the Save File dialog. Click the Create button to add the new AppCategory class files to the Project Navigator as shown in Figure 8;
New AppCategory class files
Figure 8 - The new AppCategory class files
  1. Now let's add an init method to the AppCategory class. Select the AppCategory.m file in the Project Navigator, and add an empty line between the @implementation and @end declarations;
  1. Type the init keyword to bring up the Code Completion popup, and then press return to add the init template code to the file;
  1. Replace the statements placeholder with the code shown in Figure 9.
Set the AppCategoryEntity class name
Figure 9 - Set the entityClassName property of the AppCategory class.

Again, this specifies the name of the entity class associated with the business controller.

Creating the User Business Controller

Now let's create our final class, the User business controller.

  1. Right-click the ReviewEntity.m file in the Project Navigator (so the new files are added directly below it), and select New File... from the popup menu;
  1. On the left side of the New File dialog under the iOS section, select Cocoa Touch. On the right side of the dialog, select the Objective-C class template, and then click the Next button;
  1. In the next step of the dialog, set the Class to User and set Subclass of to ABusinessObject;
  1. Click the Next button to launch the Save File dialog. Click the Create button to add the new User class files to the Project Navigator as shown in Figure 10;
New User class files
Figure 10 - The new User class files
  1. Now let's add an init method to the User class. Select the User file in the Project Navigator, and add an empty line between the @implementation and @end declarations;
  1. Type the init keyword to bring up the Code Completion popup, and then press return to add the init template code to the file;
  1. Replace the statements placeholder with the code shown in Figure 11.
Set the UserEntity class name
Figure 11 - Set the entityClassName property of the User class.

This specifies that UserEntity is the name of the entity class associated with the business controller.

Using Business Controllers with View Controllers

When you place all of your entity manipulation code in business controllers, you create an app architecture that is easier to conceive, create, and maintain. In order to use the code within these business controllers, you need to instantiate them from within your app's view controllers and pass messages to them that create, retrieve, update, and delete entities.

Figure 12 shows the collaboration between view controllers and business controllers.

View Controllers and Business Controllers
Figure 12 - View controllers can call on the services of business controllers to manipulate entities.

The grouping of view controllers and business controllers you see in this figure is actually what you are going to set up in this post and upcoming posts. Note that although the diagram only shows one business controller referenced from each view controller, a single view controller can work with multiple business controllers.

Setting Up the App Category Scene

As promised earlier in this blog series, we are going to take the iAppsReview prototype app and turn it into a real app. We'll start with the App Category scene since it's an easy one.

Currently, the App Category scene contains a hard-coded list of categories that you added when you first created the project (Figure 13).

App Category Scene
Figure 13 - The App Category scene

Rather than having a hard-coded list of categories, we want to change this scene so the categories are populated from a list of CategoryEntity objects stored in the database and dynamically retrieved at run time. This allows us to add new categories to the list in the future without changing the app. Let's get started!

  1. In the Project Navigator, select the MainStoryboard file and then scroll the storyboard so you can see the App Category scene;
  1. As shown in Figure 13, this scene has a table view that contains nine prototype cells that all have the same formatting. We only need one cell that will be used as a prototype for all cells in this table, so let's delete the last eight cells in the table view.

To do this, click the second cell in the table view to select it, hold down the shift key and click on the third through ninth cells to select them too;

  1. With these cells selected, press the delete key to delete the cells and leave the first cell remaining as shown in Figure 14;
Delete all cells but the first
Figure 14 - Delete all but the first App Category cell.
  1. In the App Category scene, click in the gray area below the table view. Go to the Attributes Inspector (third button from the right in the Inspector toolbar) and change the Content attribute from Static Cells to Dynamic Prototypes. Doing this adds a Prototype Cells header label above the table view (Figure 15).
Dynamic Prototypes
Figure 15 - Set the table view's Content to Dynamic Prototypes.

Header labels are used to describe the contents of a table view, but since the navigation bar already contains the text App Category, there's no need to use the header label. You can simply ignore the header label and it won't appear at run time;

  1. Click on the Entertainment table view cell to select it, and then go to the Attributes Inspector and set the cell's Identifier to CategoryCell (Figure 16).
Cell Identifier
Figure 16 - Set the cell's Identifier to CategoryCell.

This identifier allows you to reference this specific cell from code within your view controller, which we will create next.

Creating an AppCategoryViewController

Now we need to create a table view controller for the App Category scene. This table view controller will create an instance of the AppCategory business controller and fill the table view with AppCategoryEntity objects.

  1. Right-click the iAppsReview group folder in the Project Navigator, and select New File... from the shortcut menu;
  1. On the left side of the New File dialog under the iOS section, select Cocoa Touch. On the right side of the dialog, select the Objective-C class template, and then click Next;
  1. In the next step of the dialog, set the Class name to AppCategoryViewController, and set the Subclass of to UITableViewController (Figure 17);
Create AppCategoryViewController
Figure 17 - Create AppCategoryViewController as a subclass of UITableViewController.
  1. Click the Next button to display the Save File dialog, and then click Create to add the new AppCategoryViewController class files to the project (Figure 18);
New AppCategoryViewContoller files
Figure 18 - The new AppCategoryViewController class files
  1. Whenever you create a new view controller for a particular scene, it's a good idea to immediately go to that scene and associate it with the scene. 

To do this, go to the Project Navigator, select the Mainstoryboard file and then click the status bar at the top of the App Category scene to select the table view controller. You will know you have selected it properly when a blue highlight appears around the scene as shown in Figure 19. Next, go to the Identity Inspector (third button from the left in the Inspector toolbar) and change the class to the new AppCategoryViewController;

Set the view controller class
Figure 19 - Set the App Category view controller's class to AppCategoryViewController.
  1. Let's go back and set up the AppCategoryViewController class. Select AppCategoryViewController.m in the Project Navigator, and add the import statements shown in Figure 20 to the top of the file.
import statements
Figure 20 - Add import statements to the AppCategoryViewController.m file.

These import statements allow you to create an instance of the AppCategory business controller and work with its associated AppCategoryEntity objects;

  1. Next, add the instance variable declarations shown in Figure 21 below the @implementation declaration (don't forget to add the curly braces).
instance variables
Figure 21 - Add instance variables to the class.

The appCategory variable will be used to hold a reference to the AppCategory business controller object, and the appCategoryList array will be used to hold the AppCategoryEntity objects returned from the business controller;

  1. In the view controller's viewDidLoad method, delete all of the existing comment lines (the lines in green) and add the code shown in Figure 22 in its place.
viewDidLoad code
Figure 22 - Add code that creates an AppCategory object and retrieves a list of AppCategoryEntity objects

This code creates an instance of the AppCategory business controller class, and then sends a getAllEntities message to it, storing the resulting entities into the appCategoryList array. As its name suggests, this method returns all entities of a particular type. The AppCategory class (as well as all of your other business controller classes) inherits the getAllEntities method from the mmBusinessObject class. Rather than having to type several lines of code (as you would have to do with out-of-the-box Core Data), you only need one line of code to retrieve the CategoryEntity objects. This is the beauty of object-oriented inheritance and encapsulation!

  1. Now it's time to change the methods of the table view controller that are used to fill the associated table view in the App Category scene. In a future post I'll discuss table view controllers in greater detail, but for now I'll just give you the information you need to know to understand the basics.

Scroll down to the numberOfSectionsInTableView: method. This method is used to specify the number of sections in the table view. Delete the line that begins with #warning. Since this table view only has one section, change the method to return 1 as shown in Figure 23;

Number of sections
Figure 23 - The numberOfSectionsInTableView: method specifies the number of sections in the table view.
  1. Scroll down to the numberOfRowsInSection: method. This method specifies the number of rows in a particular section of the table view. Delete the #warning line and change the return statement to the code shown in Figure 24.
Number of rows
Figure 24 - The tableView:numberOfRowsInSection: method specifies the number of rows in a section of the table view.

Since there is only one section in this table view, we don't have to check the section number that is passed to this method. The code you have added returns the number of AppCategoryEntity objects in the appCategoryList array. This causes the table view to create one row for each entity object in the array;

  1. Now scroll down to the tableView:cellForRowIndexPath: method. Uncomment this method by deleting the /* comment characters above it and the */ comment characters below it. Change the code in this method to the code shown in Figure 24.
cellForRowAtIndexPath
Figure 24 - tableView:cellForRowAtIndexPath configures the rows in the table view

This method gets called once for every AppCategoryEntity in the appCategoryList array. The first few lines of code send a message to the table view asking it for a cell with the CategoryCell identifier. This is the identifier you specified for the remaining cell in the App Category scene earlier in this post. The table view returns the prototype cell with that identifier.

Next, this code gets the AppCategoryEntity in the appCategoryList with the specified row number. In Objective-C, collections are numbered starting with zero. So, a collection with 10 items would be numbered 0 through 9. The first time this method is called, a zero value is passed in as the row number. That zero value is then passed in the objectAtIndex: message call to the appCategoryList and the first  AppCategoryEntity object in that array is returned. The next time the method is called, a 1 is passed in the objectAtIndex: message call and the second AppCategoryEntity in the list is returned, and so on.

After an entity is retrieved, its name value is stored in the cell's main text label, and the cell is returned from the method;

  1. Now that the setup of the App Category scene is complete, it's time to run the App to see what it looks like at run time. To do this, click the Run button in Xcode. When the app appears in the Simulator, select Write a Review and then in the Write Review scene, click the App Category row and you will see the App Category scene shown in Figure 25.
Empty App Category list
Figure 25 - The App Category scene is empty!

You may be surprised to see that there aren't any rows in the table view! That's because we never created a database and added any records to it. 

Conclusion

When your app first tries to access a database, if it doesn't exist, Core Data automatically creates an empty database for you. In next week's post, we'll take a close look at this database, and then we will add CategoryEntity objects to it and see how they fill the list at run time!

<<Previous         Next>>

Tip of the Day: How to Teach Siri to Pronounce a Name Correctly

$
0
0

Using Siri to call or send messages to people can be very convenient during those times when your hands or eyes are otherwise occupied. Just don't try to call any friends or family members who have an unusual name, because if Siri doesn't know how to pronounce that name, the virtual assistant won't understand what you are asking. This can be extremely frustrating and lead to you yelling at your iPhone in public (don't ask me how I know), and it's why it can be worth it to take the time to teach Siri how to pronounce names correctly.

To teach Siri how to say a name correctly, hold the home button to activate Siri and then say, "That's not how you pronounce [name]."

Siri will then ask you how to pronounce the contact's first name. Say the name correctly. Siri will offer you three pronounciation options to choose from. Select the one that is correct. If none of the options is close enough, tap Tell Siri Again to repeat the process until you get a pronounciation you like.

Siri will then repeat the process for the contact's last name as well. Now you should have less difficulty sending messages or making calls with Siri.

 

Top image credit: Warren Goldswain/Shutterstock.com

WINNERS of the iPhone Life June 30th Biweekly Giveaway

$
0
0

Thanks to everyone who entered the June 16th iPhone Life Biweekly Giveaway! Every other week we give away three amazing prizes, so if you didn't win this time, make sure you enter the June 30th giveaway and tell your friends to enter too!

And the winners are... (drum roll please):

Jorge Estrada, Jasmine Perry, and Wm Janus. 

 

If you see your name but didn't receive an email, please check your spam folder.

Didn't Win This Week? No worries! Visit iphonelife.com/giveaways for the chance to win in the next giveaway round.

 

This week's featured items are:

1. Duracell Powermat iPhone 5 Battery Case: Retail Price $49.99

Charge wirelessly by snapping on this charging case for iPhone 5 designed by world-renowned Yves Behar. It prepares your iPhone 5 to receive on-the-go power from the SnapBattery or wireless charging from any Duracell Powermat charging surface.

 

2. Trident Kraken AMS iPhone 5s Case: Retail Price $49.95

Kraken A.M.S. Series cases are the absolute strongest, most durable cases we make. Kraken A.M.S. features three layers of protection, including over-molded shock-absorbing TPE and hardened polycarbonate in the interior and exterior of the case. The detachable aluminum media stand provides the option to attach a variety of interchangeable accessories, allowing you to use your device to its full potential. Kraken A.M.S. cases allow you to adapt your case to fit your lifestyle.

 

3. Fluxmob Bolt Stealth Battery Backup & Wall Charger: Retail Price: $

BOLT is the world's smallest portable battery backup and wall charger combined. BOLT is designed to replace your standard wall charger and will automatically charge with your phone and be ready to go when you are. This makes BOLT a true grab-and-go solution.

 

 

Questions or comments? Email Brian@iphonelife.com. Good luck and remember to visit iphonelife.com/giveaways to enter! Also check out our other contests at iphonelife.com/contests. The next contest drawing is July 14th!

Apple News: Back to School for Less

$
0
0

As much as my kids and college professor wife would like to forget, it's almost Back-to-School time, and Apple is making it a little easier with their Back-to-School promotion. College-bound students (and their parents) as well as teachers can save year round with Educational pricing, but now Apple sweetens the pot. The annual promotion covers most Macs, iPads, and since 2013, iPhones.

Mac buyers can save as much as $200, depending on the model, plus get a $100 credit for the Apple Store. iPad Air customers can save $30 off the list price, or $20 off the other iPad models including the iPad mini, plus get a $50 credit for the Apple Store.  iPhone buyers still pay the full price, but get that same $50 credit. In this case, purchasing an iPhone is probably a better deal at Wal-Mart, Best Buy, or other retailers.

There are some fine points. To qualify for education pricing or get a gift card, you must be a college student, a student accepted to a college, a parent buying for a college student, or a faculty or staff member from any grade level. They will check in store, but online you basically just select your school.

iPad Education

I got my first start with computers using a Bell & Howell Apple ][ in high school back in 1980. I progressed to the original Macintosh in 1984, at Carnegie-Mellon University, one of the few colleges to have a special deal on the Mac. The first day on campus, I bought my Mac and applied for and got a job at the school's computer store, and I later worked for Apple as their Campus Representative. So for me, Apple and education are a great match. Future programmers, entrepreneurs, and engineers need to start somewhere, and Apple is doing their part to make sure it's on Apple gear.

Vote Now in the iPhone Life Photo Contest: Voting Ends July 9!

$
0
0

Vote now in the iPhone Life iPhone Photography Contest! The voting deadline is Wednesday, July 9. Click HERE to choose your favorite images.  If you are a iPhoneographer and you haven't entered  yet, submit your best photo at  iphonelife.com/enterphoto before the entry deadline of Friday, July 4. The top 10 photos will be featured in an upcoming issue of iPhone Life magazine.

Don't worry if you can't choose just one favorite photo; you can vote for as many photos as you like. You can only vote once per day for each image though, so make sure you vote every day from now until the contest closes at 11:59 p.m. on July 9!

Here are some samples of the beautiful photos being submitted (click HERE to see all the entries):

Viewing all 13234 articles
Browse latest View live