Thursday, December 13, 2012

Write contents of array to a text file in Document Directory iPhone


NSString *stringToWrite=[[NSString alloc]init];
    
    for (int i=0; i<[arrayToReloadRightTableData count]; i++)
        
    {
        stringToWrite=[stringToWrite stringByAppendingString:[NSString stringWithFormat:@"%@ ",[arrayToReloadRightTableData objectAtIndex:i]]];
        
    }
    
    [stringToWrite writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil];
    

Tuesday, December 11, 2012

default first row on the tableview selected


  [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionNone];

Wednesday, December 5, 2012

Upload app to app store Process


Important notice from Apple regarding changes to binary submissions:

Beginning July 22, you will need to use Application Loader to submit your binary to iTunes Connect. Binary uploads will no longer be accepted through the iTunes Connect interface on that date.

Application Loader offers fast uploading, a more stable connection, and early validation warnings. You can now also submit binaries that contain In App Purchase using Application Loader. Make sure the status of your app in iTunes Connect is Waiting for Upload before you submit your binary through Application Loader.

If you have installed iPhone SDK 3.2 or later, you can access Application Loader from the Utilities folder (/Developer/Applications/Utilities/Application Loader.app). You can also download Application Loader from iTunes Connect.

If you have any questions regarding Application Loader, please review our Frequently Asked Questions or utilize the Contact Us system on iTunes Connect.


DUE TO APPLE POLICY YOU MUST USE AN INTEL BASED MAC(Power PC's will not work) TO SUBMIT YOUR APP FOR APPROVAL. IF YOU DO NOT HAVE A MAC, PLEASE CLICK HERE!

Your app status MUST say "Waiting to Upload" and not "Ready to Upload".  If you app status says "Ready to Upload", please click on View Details, then Ready to Upload Binary.  In order to be ready to deliver your binary through Application Loader, you will need to answer questions about Export Compliance.  Your answer is no.  Your app status will then say Waiting to Upload, and you can proceed with Application Loader.

Download Application Loader here. For information on using Application Loader, click here.


Once saved, open the file and follow the instructions to install the Application Loader

Picture_47.png

Once installed, open the Application Loader application and select "Next"

Picture_48.png

Enter your iTunes Connect Apple ID and Password.  Select "Next"

Picture_49.png

After the application is done loading, Select "Next" to continue

Picture_50.png

Once your applications have been reviewed, select the application you want to add to the iTunes Store and click "Next"

Picture_51.png

All AppMakr apps have been tested on iOS4, so on the next screen click "Yes" to continue

Picture_52.png

Click "Choose" to select your binary file to upload

Picture_53.png

Select the binary (AppStore .zip file you downloaded from your AppMakr account) and click "Send"

****Please note that Safari sometimes automatically unzips the binary file, if this is happening to you go to Preferences-> General tab and then uncheck "Open "safe" files after download"

Picture_55.png

Your application will take a few moments to authenticate with the iTunes Store

Picture_56.png

Once complete, and your app package has been uploaded to the iTunes Store, click "Next" to continue

Picture_57.png

Congratulations, you uploaded your binary and completed submission of your app to iTunes Connect. Click "Done"

Picture_58.png

Now your app will have a Status of "Upload Received"

Picture_59.png


To check the status of your app, log into iTunes Connect, click "Manage Your Applications" select your app and click "Status History".  For a breakdown of each application status, click here.



SOURCE:- https://appmakr.zendesk.com/entries/218997-how-to-upload-your-app-to-itunes-connect-using-application-loader 

Thursday, November 8, 2012

Copy From Resource Folder to Document Directory in iPhone SDK


NSFileManager *fileManager = [NSFileManager defaultManager];

NSError *error;

NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,
NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *documentDBFolderPath = [documentsDirectory stringByAppendingPathComponent:@"YourFolderName"];

NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath]
stringByAppendingPathComponent:@"YourFolderName"];

    [fileManager copyItemAtPath:resourceDBFolderPath toPath:documentDBFolderPath error:&error];
   


Sunday, November 4, 2012

Print HTML page from iPhone sdk


- (IBAction)printContent:(id)sender {
    UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
    pic.delegate = self;

    UIPrintInfo *printInfo = [UIPrintInfo printInfo];
    printInfo.outputType = UIPrintInfoOutputGeneral;
    printInfo.jobName = self.documentName;
    pic.printInfo = printInfo;

    UISimpleTextPrintFormatter *textFormatter = [[UISimpleTextPrintFormatter alloc]
                                                 initWithText:yourNSStringWithContextOfTextFileHere];
    textFormatter.startPage = 0;
    textFormatter.contentInsets = UIEdgeInsetsMake(72.0, 72.0, 72.0, 72.0); // 1 inch margins
    textFormatter.maximumContentWidth = 6 * 72.0;
    pic.printFormatter = textFormatter;
    [textFormatter release];
    pic.showsPageRange = YES;

    void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
    ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
        if (!completed && error) {
            NSLog(@"Printing could not complete because of error: %@", error);
        }
    };
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        [pic presentFromBarButtonItem:sender animated:YES completionHandler:completionHandler];
    } else {
        [pic presentAnimated:YES completionHandler:completionHandler];
    }
}