Monday, December 27, 2010
Update to ATV2 problem - Fixed
With most setups you could change the DNS server of your Apple TV (and iPhones, because this happens on them also) to the google address (8.8.8.8). Of you can look at your router to see what your ISPs DNS server is and use that.
If you are using DD-WRT, you can upgrade (or look, you might already have this feature if you upgraded in the last 2 months) to a version that has "No DNS Rebind" on the services page in the DNSMasq section. This turns off that security feature. Below is a picture with it turned off. Be sure to reboot your router after you make this change.
If you are using DNSMasq on something else, look into a way to turn off DNS Rebind protection. There are several commands out there for Linux based systems, but I don't have the time to go check them. You can start at this link that has some of the commands:
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=518676&sid=26f3585e507c4a2acf83f3fb817971a1
Sunday, December 26, 2010
Apple TV 2 problems
Here is what I did.
1. I connected my ATV2 directly to the back of my cable modem. This worked.
Going with the idea that maybe there is a connection that is being started from Netflix I decided to try normal port forwarding things on the router.
2. I setup UPNP. That didn't work.
3. I setup a DMZ (basically it port forwards all incoming new connections) to the ATV2. That didn't work either.
My final setup now until Apple/Netflix/Me figure out what's wrong and fix it is the following:
I used an old Ethernet switch, and have the these thigns connected to it:
1. Cable modem
2. Linksys E3000 - WAN Port (my main Internet router for my house with lots of stuff behind it)
3. ATV2 Ethernet port
The big difference in this setup is that the ATV2 has a public Internet address as opposed to a private address. If you have more than one Internet device in your house, you are probably using private addressing. Your ATV probably has an address that starts with 192.168.x.x where x any number between 1 and 254.
Wednesday, May 12, 2010
How to know in what row an accessory was clicked - TableView
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
ServerDescriptionView *serverDescriptionView = [[ServerDescriptionView alloc] initWithNibName:@"ServerDescriptionView" bundle:nil];
serverDescriptionView.profile = profile.agencyPolicyName;
ServerActiveServerView *serverActiveServerView = [[ServerActiveServerView alloc] initWithNibName:@"ServerActiveServerView" bundle:nil];
serverActiveServerView.profile = profile.agencyPolicyName;
switch (indexPath.section) {
case 1:
switch (indexPath.row) {
case 0:
// Description
[[self navigationController] pushViewController:serverDescriptionView animated:YES];
[serverDescriptionView release];
break;
case 1:
// Active Server
[[self navigationController] pushViewController:serverActiveServerView animated:YES];
[serverActiveServerView release];
break;
}
break;
case 2:
switch (indexPath.row) {
case 0:
// Server Power
break;
case 1:
// Unbind from the Template
break;
case 2:
// Reset UUID
break;
}
}
}
Tuesday, May 11, 2010
Calling methods in another class file
- (void) showAlert:(int)errorNumber;
- (void) showAlert:(int)errorNumber {
UIAlertView *error = [[UIAlertView alloc] initWithTitle:[[NSString alloc] initWithFormat:@"Error: %D", errorNumber]
message:[[NSString alloc] initWithFormat:@"This is an error"]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[error show];
[error release];
}
In the YourView.m file you are calling this new method from:
#import "YourFunctions.h"
// As a test I attached a button to this action.
- (IBAction)showAnAlert {
int errorNumber = 22;
YourFunctions *yourFunctions = [[YourFunctions alloc] init];
[yourFunctions showAlert:errorNumber];
}
Tuesday, March 23, 2010
iPhone Sequential Execution
// Start up our activity indicator while we collect the data
[self startActivityIndicator];
// Run the loadData method right now
[self performSelector:@selector(loadDataInBackground) withObject:nil afterDelay:0.0];
I can then end the Activity Indicator when I get to the end of the "loadDataInBackground" method. If we just call both of the methods, the ActivityIndicator doesn't display until just as the loadData method ends.
-Tige
Wednesday, February 03, 2010
Modifying add hoc users
If you are getting
Application was not installed on the iPhone because it could not be verified.
then your profile isn’t valid and you should check out this post. This biggest thing to remember is
- Delete all the profiles stored in
~/Library/MobileDevice/Provisioning Profile
. - Double click your .mobileprovision file and it will get loaded into XCode - There is a chance that it will get loaded by another application. If that is the case, right-click it and open it with xcode.
- Quit XCode completely. I’m not sure why this is necessary, but often XCode refuses to build unless it starts up with the profile already ready.
Lastly, ensure not only that Entitlements.plist is included in your project (click File, New File, Code Signing, Entitlements), and that get-task-allow is unchecked, but in your “Ad Hoc” build profile (Project, Edit Active Target) expand the list to “All Settings” make sure the “Code Signing Entitlements” field is filled out with your “Entitlements.plist”."
Monday, February 01, 2010
Add Hoc distribution for iPhone App
- Create a directory for your distribution, we'll call it myApp
- Create a folder in that folder called myApp/Payload
- Put a copy of myApp.app in Payload
- Put a copy of the file you want displayed in Itunes in the myApp folder
- This file should be called iTunesArtwork, no extension (I used a PNG, the same one as my apps icon)
- Create a .ipa file using the following: zip -r myAppBeta.ipa Payload
- Add the artwork to the .ipa file: zip -r myAppBeta.ipa iTunesArtwork
iPhone app, ready for Beta
For Ad Hoc Distribution, complete the following:
- In the File Menu, select New File -> iPhone OS -> Code Signing -> Entitlements. Name the file “Entitlements.plist" and click ‘Finish’. This creates a copy of the default entitlements file within the project.
- Select the new Entitlments.plist file and uncheck the “get-task-allow” property. Save the Entitlements.plist file.
- Select the Target and open the Project -> Edit Project Settings -> Build settings inspector. In the ‘Code Signing Entitlements’ build setting, type in the filename of the new Entitlements.plist file including the extension. There is no need to specify a path unless you have put the Entitlements.plist file somewhere other than the top level of the project
Sunday, January 17, 2010
Text Fields and dismissing the keyboard
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if (theTextField == userName) {
[userName resignFirstResponder];
[userPassword becomeFirstResponder];
}
if (theTextField == userPassword) {
[userPassword resignFirstResponder];
[serverAddress becomeFirstResponder];
}
if (theTextField == serverAddress) {
[serverAddress resignFirstResponder];
}
return YES;
}
Ok, I wrote the if statements before I even finished writing this blog. It's messy, so if you know a bette/faster way to do this, do it your way!
- (BOOL)textFieldShouldReturn:(UITextField *)aTextField {
if (aTextField == userName) {
[userName resignFirstResponder];
if ([userPassword.text length] == 0) {
[userPassword becomeFirstResponder];
} else if ([serverAddress.text length] == 0) {
[serverAddress becomeFirstResponder];
}
}
if (aTextField == userPassword) {
[userPassword resignFirstResponder];
if ([serverAddress.text length] == 0) {
[serverAddress becomeFirstResponder];
}
}
if (aTextField == serverAddress) {
[serverAddress resignFirstResponder];
}
return YES;
}
Thursday, January 14, 2010
Working with SQL Databases on iPhone
Monday, January 11, 2010
Refreshing views while using a Tab Bar on the iPhone
- (void)viewWillAppear:(BOOL)animated {
// Do stuff here
[super viewWillAppear:animated];
}
Thursday, January 07, 2010
Handling iPhone errors part two
- (IBAction)refreshInformation:(id)sender;
- (int)verifyUserInput;
- (void)handleErrors:(int)errorNumber;
- (IBAction)refreshInformation:(id)sender {
NSInteger funcReturn = 0;
// Verify they have entered everything we need to get the information
funcReturn = [self verifyUserInput];
// Did we have any errors?
if (funcReturn) {
[self handleErrors:funcReturn];
}
}
- (int)verifyUserInput {
// Initialize some local variables with the input from the user
NSString *nameString = userName.text;
NSString *passString = userPassword.text;
NSString *serverString = serverAddress.text;
// Verify that people are putting the right stuff into the fields
if ([nameString length] == 0) {
return 11;
} else if ([passString length] == 0) {
return 11;
} else if ([serverString length] == 0) {
return 11;
}
return 0;
}
- (void)handleErrors:(int)errorNumber {
NSString *errorText;
switch (errorNumber) {
case 11:
errorText = @"All fields are required";
break;
case 21:
errorText = @"Authentication failed";
break;
case 22:
errorText = @"System login failure";
break;
case 23:
errorText = @"Read-Only user required";
break;
case 24:
errorText = @"Network connection failed";
break;
}
UIAlertView *error = [[UIAlertView alloc] initWithTitle:[[NSString alloc] initWithFormat:@"Error: %D", errorNumber]
message:[[NSString alloc] initWithFormat:@"%@", errorText]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[error show];
[error release];
}
Wednesday, January 06, 2010
Handling Errors on the iPhone
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"This is the error or get a string"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
[alert release];