dimanche 30 novembre 2014

apple store rejected anonymous calling app

We developed VoIP based anonymous calling app for iOS app but apple rejected our app saying we can not launch an app with random/anonymous features but same time few other apps are live in apple store.


Parlor – Anonymous Talk & OnDemand Conversation Partyline - anonymous voice chat


Can anyone help us ?




Performing a Segue from a UIView programatically

I'm trying to create a custom UIView that will, when tapped, segue to a new view controller. I'd like to do this programmatically rather than in Interface Builder. How do I get a reference to the destination view controller when I'm doing this? I assume I don't just create one and set it as the next view or something, so where does the reference come from? Since when it's done in the storyboard you simply choose where you want the segue to have as the destination, it's not an issue there, however programmatically I don't understand where that reference comes from.


I'm doing this in Swift as well. I don't think that really makes a big difference, but it might change something.


I tried using a UIView with a tapGestureRecognizer added, which then performed the segue when tapped, however I was getting an unrecognized selector error.




Table view with UIBlurEffect become laggy

i have problem with tableview, after implementing top bar with uiblurview tableview is laggy on iphone5 scrolling tableview takes 20-25% cpu, before adding blur view. Worked perfectly. looking forward for any performance help



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"Cell%li%i",(long)indexPath.row,cellvar]];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[NSString stringWithFormat:@"Cell%li%i",(long)indexPath.row,cellvar]];

if ([self.obrazki count]>0) {
CGRect imageFrame = CGRectMake((cell.frame.size.width/tableViewOffset)-(tableView.frame.size.width*0.92/2), 10, tableView.frame.size.width*0.92, tableView.frame.size.width*0.92);
UIImageView * image = [[UIImageView alloc] initWithFrame:imageFrame];
image.layer.masksToBounds = YES;
image.layer.cornerRadius = 25;
[image setImage:[self.obrazki objectAtIndex:indexPath.row]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
image.backgroundColor = [UIColor clearColor];
[cell addSubview:image];
cell.backgroundColor = [UIColor clearColor];

UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView= [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame = CGRectMake((cell.frame.size.width/tableViewOffset)-(tableView.frame.size.width*0.92/2)-0.5, 9,tableView.frame.size.width*0.92+1,35);
CAShapeLayer * maskLayer = [CAShapeLayer layer];
maskLayer.path = [UIBezierPath bezierPathWithRoundedRect: visualEffectView.bounds byRoundingCorners: UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii: (CGSize){25.0, 25.0}].CGPath;

visualEffectView.layer.mask = maskLayer;
visualEffectView.layer.masksToBounds = YES;
[cell addSubview:visualEffectView];

UILabel *likeCount = [[UILabel alloc] initWithFrame:CGRectMake((cell.frame.size.width/tableViewOffset)-(tableView.frame.size.width*0.92/2)+distanceFromStart, 4,tableView.frame.size.width*0.92,35)];
likeCount.text = [NSString stringWithFormat:@"%@",[imagesLikes objectAtIndex:indexPath.row]];
likeCount.backgroundColor = [UIColor clearColor];
likeCount.tintColor = [UIColor blackColor];
likeCount.font = [UIFont fontWithName:@"AppleSDGothicNeo-Thin" size:20];
[visualEffectView addSubview:likeCount];
CGRect imageLikeFrame = CGRectMake(likeCount.frame.origin.x-20, likeCount.frame.origin.y+7.5, 16, 16);
UIImageView * imageLike = [[UIImageView alloc] initWithFrame:imageLikeFrame];
[imageLike setImage:[UIImage imageNamed:@"like.png"]];
imageLike.layer.masksToBounds=YES;
imageLike.backgroundColor = [UIColor clearColor];
[visualEffectView addSubview:imageLike];
NSLog(@"Generating:%i",indexPath.row);
}
}
// NSLog(@"LoadingOnView:%i",indexPath.row);
return cell;
}



how to sqlite demo implement in iphone?

i have implement this type of code to sqlite databade


ViewController.m



//
// ViewController.m
// SQLiteTutorial
//
// Created by Admin on 17/07/14.
// Copyright (c) 2014 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"
#import "DataController.h"
#import "Person.h"
@implementation ViewController

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Create datacontroller and initialize database
DataController *dataController = [[DataController alloc]init];
[dataController initDatabase];
//[dataController release];

// Create address and person objects
Address *address = [[Address alloc]initWithStreetName:@"Infinite Loop" andStreetNumber:[NSNumber numberWithInt:1]];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *birthday = [dateFormatter dateFromString: @"1955-02-24"];
Person *person = [[Person alloc]initWithFirstName:@"Steve" andLastName:@"Jobs" andBirthday:birthday andAddress:address];

// Insert the person
[dataController insertPerson:person];



// // Get the persons
// NSArray* persons = [dataController getPersons];
// NSLog(@"Persons count: %d", [persons count]);

// // Update the address
// Address *updateAddress = [[Address alloc]initWithStreetName:@"Microsoft Way" andStreetNumber:[NSNumber numberWithInt:666]];
// [dataController updateAddress:updateAddress];
// [updateAddress release];
// Cleanup
[dateFormatter release];
[address release];
[person release];
[DataController release];

}

- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end


this my main view controller file then i have created datamanager


DataController.h



//
// DataController.h
// SQLiteTutorial
//
// Created by Admin on 17/07/14.
// Copyright (c) 2014 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>
#import "Person.h"
#import "Address.h"
@interface DataController : NSObject
{
sqlite3 *databaseHandle;
}

-(void)initDatabase;
-(void)insertPerson:(Person*)person;
-(NSArray*)getPersons;
-(void)updateAddress:(Address*)address;
-(Address*)getAddressByPersonID:(int)personID;
@end


DataController.m



#import "DataController.h"
#import "Person.h"
@implementation DataController

// Method to open a database, the database will be created if it doesn't exist
-(void)initDatabase
{
// Create a string containing the full path to the sqlite.db inside the documents folder
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = @"/Users/Admin/Movies";//[paths objectAtIndex:0];
NSString *databasePath = [documentsDirectory stringByAppendingPathComponent:@"SQLiteTutorial3.db"];

// Check to see if the database file already exists
bool databaseAlreadyExists = [[NSFileManager defaultManager] fileExistsAtPath:databasePath];

// Open the database and store the handle as a data member
if (sqlite3_open([databasePath UTF8String], &databaseHandle) == SQLITE_OK)
{
// Create the database if it doesn't yet exists in the file system
if (!databaseAlreadyExists)
{
// Create the PERSON table
const char *sqlStatement = "CREATE TABLE IF NOT EXISTS PERSON (ID INTEGER PRIMARY KEY AUTOINCREMENT, FIRSTNAME TEXT, LASTNAME TEXT, BIRTHDAY DATE)";
char *error;
if (sqlite3_exec(databaseHandle, sqlStatement, NULL, NULL, &error) == SQLITE_OK)
{
// Create the ADDRESS table with foreign key to the PERSON table
sqlStatement = "CREATE TABLE IF NOT EXISTS ADDRESS (ID INTEGER PRIMARY KEY AUTOINCREMENT, STREETNAME TEXT, STREETNUMBER INT, PERSONID INT, FOREIGN KEY(PERSONID) REFERENCES PERSON(ID))";
if (sqlite3_exec(databaseHandle, sqlStatement, NULL, NULL, &error) == SQLITE_OK)
{
NSLog(@"Database and tables created.");
}
else
{
NSLog(@"Error: %s", error);
}
}
else
{
NSLog(@"Error: %s", error);
}
}
}
}

// Method to store a person and his associated address
-(void)insertPerson:(Person*)person
{
// Create insert statement for the person
NSString *insertStatement = [NSString stringWithFormat:@"INSERT INTO PERSON (FIRSTNAME, LASTNAME, BIRTHDAY) VALUES (\"%@\", \"%@\", \"%@\")", person.firstName, person.lastName, person.birthday];

char *error;
if ( sqlite3_exec(databaseHandle, [insertStatement UTF8String], NULL, NULL, &error) == SQLITE_OK)
{
int personID = sqlite3_last_insert_rowid(databaseHandle);

// Create insert statement for the address
insertStatement = [NSString stringWithFormat:@"INSERT INTO ADDRESS (STREETNAME, STREETNUMBER, PERSONID) VALUES (\"%@\", \"%@\", \"%d\")", person.address.streetName, person.address.streetNumber, personID];
if ( sqlite3_exec(databaseHandle, [insertStatement UTF8String], NULL, NULL, &error) == SQLITE_OK)
{
NSLog(@"Person inserted.");
}
else
{
NSLog(@"Error: %s", error);
}
}
else
{
NSLog(@"Error: %s", error);
}
}

// Get an array of all persons stored inside the database
-(NSArray*)getPersons
{
// Allocate a persons array
NSMutableArray *persons = [[NSMutableArray alloc]init];

// Create the query statement to get all persons
NSString *queryStatement = [NSString stringWithFormat:@"SELECT ID, FIRSTNAME, LASTNAME, BIRTHDAY FROM PERSON"];

// Prepare the query for execution
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(databaseHandle, [queryStatement UTF8String], -1, &statement, NULL) == SQLITE_OK)
{
// Iterate over all returned rows
while (sqlite3_step(statement) == SQLITE_ROW) {

// Get associated address of the current person row
int personID = sqlite3_column_int(statement, 0);
Address *address = [self getAddressByPersonID:personID];

// Convert the birthday column to an NSDate
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss Z";
NSString *birthdayAsString = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 3)];
NSDate *birthday = [dateFormatter dateFromString: birthdayAsString];
[dateFormatter release];

// Create a new person and add it to the array
Person *person = [[Person alloc]initWithFirstName:[NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 1)]
andLastName:[NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 2)]
andBirthday:birthday
andAddress:address];
[persons addObject:person];

// Release the person because the array takes ownership
[person release];
}
sqlite3_finalize(statement);
}
// Return the persons array an mark for autorelease
return [persons autorelease];
}

// Get an address by means of the associated person ID
-(Address*)getAddressByPersonID:(int)personID
{
Address *address = nil;
// Create the query statement to find the correct address based on person ID
NSString *queryStatement = [NSString stringWithFormat:@"SELECT ID, STREETNAME, STREETNUMBER, PERSONID FROM ADDRESS WHERE PERSONID = %d", personID];

// Prepare the query for execution
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(databaseHandle, [queryStatement UTF8String], -1, &statement, NULL) == SQLITE_OK)
{
// Create a new address from the found row
while (sqlite3_step(statement) == SQLITE_ROW) {
address = [[Address alloc]initWithStreetName:[NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 1)]
andStreetNumber:[NSNumber numberWithInt:sqlite3_column_int(statement, 2)]];
}
sqlite3_finalize(statement);
}
// Return the found address and mark for autorelease
return [address autorelease];
}

// Close the database connection when the DataController is disposed
- (void)dealloc {
sqlite3_close(databaseHandle);
[super dealloc];
}


// Update an address
-(void)updateAddress:(Address*)address
{
// This is left as an exercise to extend both the Address and Person class with an ID and use this ID for the update
int addressID = 1;

// Create the replace statement for the address
NSString *replaceStatement = [NSString stringWithFormat:@"REPLACE INTO ADDRESS (ID, STREETNAME, STREETNUMBER) VALUES (%d, \"%@\", %@);", addressID, address.streetName, address.streetNumber];

// Execute the replace
char *error;
if (sqlite3_exec(databaseHandle, [replaceStatement UTF8String], NULL, NULL, &error) == SQLITE_OK)
{
NSLog(@"Address updated");
}
else
{
NSLog(@"Error: %s", error);
}
}

@end


Address.h



#import <Foundation/Foundation.h>

@interface Address : NSObject
{
NSString *streetName;
NSNumber *streetNumber;
}

@property (nonatomic, retain) NSString* streetName;
@property (nonatomic, retain) NSNumber* streetNumber;

-(id)initWithStreetName:(NSString*)aStreetName
andStreetNumber:(NSNumber*)streetNumber;
@end


Address.m



#import "Address.h"

@implementation Address
@synthesize streetName;
@synthesize streetNumber;

// Custom initializer
-(id)initWithStreetName:(NSString*)aStreetName
andStreetNumber:(NSNumber*)aStreetNumber
{
self = [super init];
if(self) {
self.streetName = aStreetName;
self.streetNumber = aStreetNumber;
}
return self;
}

// Cleanup all contained properties
- (void)dealloc {
[self.streetName release];
[self.streetNumber release];
[super dealloc];
}
@end


One could say that this tutorial is composed by three parts. In the first and most important one, we are going to create a new class and in there we’ll implement all the database handling. As I have already said in the introduction, after we have it finished, you can take it and use it as a reusable component to your own apps. In the second part we are going to leave Xcode for a while, as it’s necessary to work in the Terminal and in the SQLite command line environment?




how to pass data to next view on button click using collection view in iphone

Right now I am working with coredata and collection. I have an entity in coredta named "Employee" and it has multiple attributes(emp_id,name,address,dept). I am done with saving the data and successfully fetching the data. The thing is that I am using collection view and I am using delegate method("cellForItemAtIndexPath")of collection view and under this I am passing 'Employee'entity data from the coredata. I am setting the title of button by using the employee name(the no of buttons is equal to no of rows in coredata).


The problem starts here right now I want to perform an action on button click in that I want when I click a particular button I want to navigate to another controller and want to display all the information regarding that employee.I dont know how to do this I am pasting my code below.Your replies are mostly welcome:



- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
info = [array objectAtIndex:indexPath.row];
static NSString *cellIdentifier = @"empCell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
titlebutton = (UIButton *)[cell viewWithTag:100];
[titlebutton addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside];
[titlebutton setTitle:info.name forState:UIControlStateNormal];
return cell;
}


Here info is the instance of Employee entity. Buttons are displaying fine with their title as the name of employees in coredata. Here in this case I want to pass the id of each employee(say for button1 it is "1"..button2 it is "2") to another controller on button click. The prob is that the id which I m getting is for last button only because on run time the previous emp id is replaced by the last one. And here I am dealing with that particular prob i.e. how to pass each emp id to next controller on button click.




How to allow the Horizontal scrollview to scroll to the first element in IOS?

I had a scrollview in my application with dynamic elements which i am adding from right to left like this



if(array.count>0)
{
[[cell.contentView viewWithTag:777] removeFromSuperview];

float x=315.0;
float width=0.0;
UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(70, 52,245,20)];
scroll.backgroundColor=[UIColor clearColor];
scroll.tag=777;
[scroll setContentOffset:CGPointMake(70,245)];
scroll.showsHorizontalScrollIndicator=NO;

for(int i =0; i <[array count] ; i++)
{

UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];

[btn setBackgroundColor:[UIColor colorWithRed:133.0/255.0 green:155.0/255.0 blue:179.0/255.0 alpha:1.0]];
btn.layer.cornerRadius = 2;


[btn setTitle:[[array objectAtIndex:i] objectForKey:@“ggg”] forState:UIControlStateNormal];
btn.userInteractionEnabled=NO;
[btn.titleLabel setFont:[UIFont fontWithName:@"Helvetica Neue" size:10.0]];
CGSize size = [btn.titleLabel.text sizeWithAttributes:
@{NSFontAttributeName:
[UIFont fontWithName:@"Helvetica Neue" size:10.0]}];
x=x-(size.width+10);

//or whatever font you're using
[btn setFrame:CGRectMake(x,0,size.width+10,15)];
[scroll addSubview:btn];
width=width+x;
x=x-5;
}

scroll.contentSize=CGSizeMake((width+5000),20);
// [scroll setPagingEnabled:YES];
[cell.contentView addSubview:scroll];


}


here everything working very fine,but i am not able to scroll to the last element added at the left.scroll was only allowing me to scroll up to 70 from left to right .Can anybody tell me where i am going wrong on this?




Change items in navigation bar on device rotation

I have custom UIBarButton items added to UINavigationBar as rightbaritems. I add two more items in UIBarButton when device goes to landscape mode. I am getting rotation call and I am correctly removing items from UIBarbuttons array, but my navigationbar item set never gets updates.


I am not sure how I can change navigationbaritems on device rotation. Per me I am doing all things correct.


-(void)setUpOnRotation:(BOOL)toPortrait{



_searchMessage = [[UILabel alloc] initWithFrame:CGRectMake(3.0, 0, 110, 20)];
_searchMessage.numberOfLines = 2;
_searchMessage.textColor = [UIColor blackColor];
_searchMessage.font = [UIFont systemFontOfSize:8.0];
_searchMessage.text = @"";

_searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 15, 130, 25)];
_searchBar.delegate = self;
_searchBar.showsCancelButton = NO;
UIBarButtonItem* doneButton = [BarButtons doneButtonWithTarget:self action:@selector(cancel)];
UIBarButtonItem *searchActivityItem = [[UIBarButtonItem alloc] initWithCustomView:_searchMessage];
UIBarButtonItem *searchItem = [[UIBarButtonItem alloc] initWithCustomView:_searchBar];
UIBarButtonItem *in = [BarButtons nativeButtonNamed:@"In"
title:@"In"
target:self
action:@selector(In)];
UIBarButtonItem *out = [BarButtons nativeButtonNamed:@"Out"
title:@"Out"
target:self
action:@selector(Out)];


NSMutableArray *itemsSet;
itemsSet = [NSMutableArray arrayWithObjects:in,
out,
searchItem,
searchActivityItem,
doneButton, nil];
if (toPortrait) {
if ([itemsSet containsObject:searchItem] || [itemsSet containsObject:searchActivityItem]) {
[itemsSet removeObject:searchActivityItem];
[itemsSet removeObject:searchItem];
}
}


[_searchBar release];
[searchItem release];
[_searchActivity release];
[_searchMessage release];
[searchActivityView release];


self.navigationItem.rightBarButtonItems = itemsSet;


}


Note: setUpOnRotaion method is called from willAnimateRotationToInterfaceOrientation and viewWillAppear with UIInterfaceOrientationIsPortrait(self.intefaceOrientaion) and it does give me correct result. I have debugged.




iOS where should I download and store index.html

I want to download a Javascript/Html5 code in zip format and then unzip the code and load the index.html file in webview in iOS.


So where should I save this zip folder on iPhone ? Document Directory or cached Directory ?




Developing universal in Xcode 6+

I have Xcode 6 installed and I'm trying to develop an universal app. Before Xcode 6, you had to create 2 separate Storyboards for iPad and iPhone and you could set it in the Deployment Info. How to manage storyboard without using Autolayout and size class ?




How to read download file from path in ios

I have tried to download and read a file (pdf/epub). I have achieved download and save the file in below path.


Download path is - file path



/Users/apple/Library/Application Support/iPhone Simulator/7.1/Applications/B5C69537-DBAA-45DA-BDF3-84D0F038378D/Documents/3471.epub


But I unable to read from the same path. I am using the below coding for reading the file path.



NSString *testpath =[[NSBundle mainBundle] pathForResource:@"3471" ofType:@"epub"];



Jailbroken iPhone breaking some code

I have an iPhone 6 that I just recently jailbroke that I've been using for development. Recently, I've encountered some weird problems with development where the iPhone behaves differently in the simulator.


Here's the code that I'm running. It's part of a method to convert an HTML color code to a UIColor:



+ (UIColor*) colorWithHex:(NSString *)hex
{
NSLog(@"HEX: %@", hex);

if(hex.length == 3)
{
//FFF
NSString* char1 = [hex substringWithRange:NSMakeRange(0, 1)];
NSString* char2 = [hex substringWithRange:NSMakeRange(1, 1)];
NSString* char3 = [hex substringWithRange:NSMakeRange(2, 1)];

return [UIColor colorWithRed:[self hexValue:[NSString stringWithFormat:@"%@%@", char1, char1]] green:[self hexValue:[NSString stringWithFormat:@"%@%@", char2, char2]] blue:[self hexValue:[NSString stringWithFormat:@"%@%@", char3, char3]] alpha:1];
}
else if(hex.length == 4)
{
//#FFF
NSString* char1 = [hex substringWithRange:NSMakeRange(1, 1)];
NSString* char2 = [hex substringWithRange:NSMakeRange(2, 1)];
NSString* char3 = [hex substringWithRange:NSMakeRange(3, 1)];

return [UIColor colorWithRed:[self hexValue:[NSString stringWithFormat:@"%@%@", char1, char1]] green:[self hexValue:[NSString stringWithFormat:@"%@%@", char2, char2]] blue:[self hexValue:[NSString stringWithFormat:@"%@%@", char3, char3]] alpha:1];
}
else if(hex.length == 6)
{
//FFFFFF
return [UIColor colorWithRed:[self hexValue:[hex substringWithRange:NSMakeRange(0, 2)]] green:[self hexValue:[hex substringWithRange:NSMakeRange(2, 2)]] blue:[self hexValue:[hex substringWithRange:NSMakeRange(4, 2)]] alpha:1];
}
else if(hex.length == 7)
{
//#FFFFFF
return [UIColor colorWithRed:[self hexValue:[hex substringWithRange:NSMakeRange(1, 2)]] green:[self hexValue:[hex substringWithRange:NSMakeRange(3, 2)]] blue:[self hexValue:[hex substringWithRange:NSMakeRange(5, 2)]] alpha:1];
}

return nil;
}




There's a couple problems here:


1. NSLogs


The NSLog (first line) simply doesn't run on my jailbroken phone. Run that in the simulator and it's fine.


2. The return value


If I run this:



NSLog(@"%@", [UIColor colorWithHex:@"ffffff"]);


This is what I get:


Simulator:



UIDeviceRGBColorSpace 1 1 1 1



iPhone 6:



UIDeviceRGBColorSpace 0.0588235 1 1 1





I have discovered that this code runs properly on my iPhone if I use the 7 character hex as opposed to the 6 character, e.g. #ffffff instead of ffffff, but that should be irrelevant. Furthermore, the NSLog is still not firing, so that's a problem. I don't know what else could be broken.


The weirdest part is that I started developing this app on my jailbroken iPhone, but only today did it start doing this weird stuff.


Has anyone else encountered these problems and/or have any ideas on how to fix it (without resetting the phone back to vanilla iOS)?




Getting Error while setting Launchimage in XCode 6.1 in iOS app

Hi I am developing iOS application using XCode 6.1. When i am trying to set launch image it giving error like below.


Asset Catalog compiler error.


None of the input catalogs contained a matching launch image set named "LaunchImage".


I searched for this problem i am unable to find exact solution.


Someone help in this issue.


Thanks in Advance.




Adding different UITapGestureRecognizer to UIViews

I've made a custom UIView that appears in my app in two places. It first appears in a regular view controller along with a text view, and then a tap gesture on the UIView moves to another view controller where the custom UIView is shown enlarged. I want to have a different tap gesture for the enlarged UIView, but when I tried putting this into the storyboard, the first tap gesture stopped working (since the new tap gesture was only reachable via the first tap gesture's segue to the new view controller, I wasn't able to see if it worked or not.


Does adding the second UITapGestureRecognizer to the view cause the first to become invalid? I don't see any other reason this would've caused an issue. If so, do I need to create separate classes for the two different custom UIViews? I tried to avoid this since they're showing the same thing just in different sizes but it seems the different tap gestures may be causing an issue.




Objective C code for iPhone app

hi I'm writing a code for an iPhone app in objective C and i want my button called SignUp when pressed by user to send alert message as shown is "-(void) registerNewUser" how can i do it? also how do i make it check for existing emails?? Thanks



#import "SignUpViewController.h"

@interface SignUpViewController ()


@end

@implementation SignUpViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.Password2.secureTextEntry=YES;
self.ReEnterPassword.secureTextEntry=YES;
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/

- (IBAction)SignUp:(id)sender {
//check if all text fields are completed

if ([_Email.text isEqualToString:@""] ||[_Password2.text isEqualToString:@""] || [_ReEnterPassword.text isEqualToString:@""]) {
UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"You must complete all fields" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];

[error show];
}
else {
[self CheckPasswords];
}
}



- (void) CheckPasswords {

//check that the two apssword fields are identical
if ([_Password2.text isEqualToString:_ReEnterPassword.text]) {
NSLog(@"Passwords match!");
[self Agree];//call Action;
}
else {
UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Passwords do not match" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];

[error show];
}

}
- (IBAction)Agree:(id)sender {
if(_Agree.selectedSegmentIndex == 0){
[self registerNewUser];
}

else{ UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"You must accept Terms and Conditions" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];

[error show];
;}
}

- (void) registerNewUser {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
//write the username and password and set BOOL value in NSUserDefaults
[defaults setObject:_Email.text forKey:@"Username"];
[defaults setObject:_Password2.text forKey:@"Password"];
[defaults setBool:YES forKey:@"Registered"];
[defaults synchronize];
if(_SignUp.buttonType == 1){

UIAlertView *success = [[UIAlertView alloc] initWithTitle:@"Success" message:@"You have registered a new user" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[success show];
}


}

@end



Getting Facebook Mutual Likes using Graph API

How should I use this to get the mutual likes between 2 facebook users?


Please help.


Refer this link for details: http://ift.tt/1pEHWeG




navigaitonbar back button is not working properly

my problem is navigation bar button is not working properly,that is going forward properly but not going backwards.please solve my problem i tried a lot.but i didn't got. - (IBAction)showLeftSideBar:(id)sender { if ([[SidebarViewController share] respondsToSelector:@selector(showSideBarControllerWithDirection:)]) { [[SidebarViewController share] showSideBarControllerWithDirection:SideBarShowDirectionLeft]; } else [[SidebarViewController share] showSideBarControllerWithDirection:SideBarShowDirectionRight];


}




How to add and check for a confirm password to Sign Up via Parse

On my sign up page I want users to confirm the password they chose using a confirm password textfield. I am using Swift.


Here is my code for my Sign Up



if(newUser.password != self.confirmPassword.text){


let alertController = UIAlertController(title: "Sign Up Failed", message: "Sorry, your Passwords were not matching.", preferredStyle: .Alert)


let OKAction = UIAlertAction(title: "OK", style: .Default) { (action) in
// ...
}
alertController.addAction(OKAction)

self.presentViewController(alertController, animated: true) {
// ...
}
}


This is in my @IBAction func confirmButton(sender: AnyObject)


Edit:


I am not getting an error, Parse still sign ups users if I just fill out a two different passwords or no password at all.


Thanks.




Not able to access subviews from storyboard

I have a UIVewcontrollerObject in storyboard. I have added an image view and 2 labels in the view and created the IBOutlet connection But i'm not able to set values to these subviews. when i log the objects, it printing a null value. How can i solve this. any idea ?


Thanks for any suggestion?




keep corporate app alive in background

I am developing a corporate app that will be publish on an internal store. The app is just supposed to keep in memory some credentials but I can't store them on the device for security reasons.


I want the app to stay in background as long as possible but I don't know what is the best solution knowing that I won't have to publish the app in the AppStore.


I read about the option in plist Required background modes, but I don't know which option is the most efficient for my situation.




Can i receive the phone calls from iOS application?

I wanted to develop an app where i can answer the phone call from my ios application.if it is possible can you please send information regarding this.




Google Maps JavaScript API v3 - Autocomplete fields on webpage viewed on iPhone do not store a value, returns no places

I'm building a web page which has two text fields and a Google Map. A user enters a start location in the first box and a destination in the second box, then they get some info back from Google about the distance, etc.


The text boxes are hooked up for Autocomplete for Places, so as you start typing a list of suggestions should appear.


The problem I'm having is that on iPhones the text boxes are not holding a value. As soon as I move focus away from the field I am editing, (e.g. tap the next text box,) the text I have entered goes away. Also, no autocomplete results are appearing, so the user can't pick one to then trigger a place_changed event and carry on getting the distance, etc.


Example link showing the problem: http://ift.tt/12aViVX


Testing:



  • Works fine on desktop browsers, (tried FF, Chrome and Safari on OSX so far.)

  • Works fine on my Nexus 7 tablet using Chrome.

    • Didn't try other browsers. Didn't try an Android phone.



  • Works fine using Safari in iOS Simulator, (set to iPhone 5S,) and on an iPad Air, (which may have been running iOS7.)

    • Didn't test other browsers.



  • Does not work on my iPhone 5S with iOS 8.1 using Safari or Chrome.

    • Didn't try other versions of iOS, other iPhone models or other browsers.




How can I resolve this? Are things working as expected, but perhaps there is a resolution limit for showing autocomplete results? If so, do I have to disable autocomplete for lower resolutions and do something else or those users?




iPhone: getting a call status

When sending an email we can get a status for the user action if the email went through, was cancelled, error etc. (sms has the same functionality with different function)



- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
NSString* mailResult;
switch (result)
{
case MFMailComposeResultCancelled:
mailResult = @"e-mail cancelled";
break;
case MFMailComposeResultSaved:
mailResult = @"e-mail saved";
break;
case MFMailComposeResultSent:
mailResult = @"e-mail sent";
break;
case MFMailComposeResultFailed:
mailResult = @"e-mail sent failure: %@", [error localizedDescription];
break;
default:
break;
}


is there something simillar for phone calls? because the system "phone call" message box has a call & cancel button and I wish to know when the user pressed cancel.



[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"telprompt://%@",self.phoneNumber]]];



Adding New Table View Row from Separate Detail View UILabel

I have a Table View (TableView1) which pushes detail to a detail view. I want to be able to draw the information on the detail view (UILabel Text and UIImageView Image) and send it to another Table View (TableView2) to create an editable list. I also do not want to add multiple rows of the same information.


Any pointers? Thanks in advance




Dynamically reduce UICollectionViewCell size

I am developing a news feed application which needs to display a photo and text below it. For some items the text is not present and I need to reduce the size of cell depending on it. How do I achieve it ? This is what I have.



- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView reloadData];
CGSize size;

if (!reviewExist)
{
size = CGSizeMake(collectionViewFrame.frame.size.width, collectionViewFrame.frame.size.height/3);
}
else
{
size = CGSizeMake(collectionViewFrame.frame.size.width, collectionViewFrame.frame.size.height);
}
return size;
}


Now review text can be big or small. How do I calculate the cell height and dynamically pass it ?




Adding an object to a TableViewController crash

I am following an Apple.developer.com tutorial. The goal is to create an easy to-do list app in iOS. Everything works fine, until I hit the doneButton to add an item. Than my mac switches back to xcode from the simulator, and I cannot really understand the error. Here`s my app: http://screencast.com/t/y0vJ1LboF9Wv As you can see, everything is works great, until I hit the doneButton WITH text in the textfield. I think the error is in the


XYZAddToDoItemViewController.m:



#import "XYZAddToDoItemViewController.h"

@interface XYZAddToDoItemViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *doneButton;

@end

@implementation XYZAddToDoItemViewController

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if (sender != self.doneButton) return;
if (self.textField.text.length > 0) {
self.toDoItem = [[XYZToDoItem alloc] init];
self.toDoItem.itemName = self.textField.text;
self.toDoItem.completed = NO;
}
}



- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)unwindToList:(UIStoryboardSegue *)segue
{
XYZAddToDoItemViewController *source = [segue sourceViewController];
XYZToDoItem *item = source.toDoItem;
if (item != nil) {
[self.toDoItems addObject:item];
[self.tableView reloadData];

}

}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section {

// Return the number of rows in the section.
return [self.toDoItems count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"ListPrototypeCell" forIndexPath:indexPath];
XYZToDoItem *toDoItem = [self.toDoItems objectAtIndex:indexPath.row];
cell.textLabel.text = toDoItem.itemName;
if (toDoItem.completed) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;

}
return cell;
}


# pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
XYZToDoItem *tappedItem = [self.toDoItems objectAtIndex:indexPath.row];
tappedItem.completed = !tappedItem.completed;
[tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationNone];
}

@end


It has something to do with the prepareForSegue methode. The explaining of the error is:



2014-11-24 16:43:01.745 TooDooList[8174:138535] -[XYZAddToDoItemViewController textField:]: unrecognized selector sent to instance 0x7faf7a5d6660
2014-11-24 16:43:01.759 TooDooList[8174:138535] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[XYZAddToDoItemViewController textField:]: unrecognized selector sent to instance 0x7faf7a5d6660'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102d47f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001029e0bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000102d4f04d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000102ca727c ___forwarding___ + 988
4 CoreFoundation 0x0000000102ca6e18 _CF_forwarding_prep_0 + 120
5 UIKit 0x00000001031358be -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x000000010323c410 -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x00000001038684cb -[UITextField _resignFirstResponder] + 256
8 UIKit 0x00000001032ab47b -[UIResponder resignFirstResponder] + 114
9 UIKit 0x00000001038682d4 -[UITextField resignFirstResponder] + 114
10 UIKit 0x000000010319ef9f -[UIView(Hierarchy) _removeFirstResponderFromSubtree] + 161
11 UIKit 0x000000010319f45a __UIViewWillBeRemovedFromSuperview + 76
12 UIKit 0x000000010319f1c9 -[UIView(Hierarchy) removeFromSuperview] + 91
13 UIKit 0x0000000103239599 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke485 + 222
14 UIKit 0x0000000103235b75 -[UIPresentationController transitionDidFinish:] + 87
15 UIKit 0x00000001037fb298 -[_UIFullscreenPresentationController transitionDidFinish:] + 71
16 UIKit 0x0000000103238301 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 133
17 UIKit 0x000000010388aac3 -[_UIViewControllerTransitionContext completeTransition:] + 110
18 UIKit 0x000000010323326f -[UITransitionView _didCompleteTransition:] + 1120
19 UIKit 0x000000010318de6a -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 209
20 UIKit 0x000000010318e1a0 -[UIViewAnimationState animationDidStop:finished:] + 76
21 QuartzCore 0x0000000106a1e7ee _ZN2CA5Layer23run_animation_callbacksEPv + 308
22 libdispatch.dylib 0x00000001052a27f4 _dispatch_client_callout + 8
23 libdispatch.dylib 0x000000010528b8fb _dispatch_main_queue_callback_4CF + 949
24 CoreFoundation 0x0000000102caffe9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
25 CoreFoundation 0x0000000102c72eeb __CFRunLoopRun + 2043
26 CoreFoundation 0x0000000102c72486 CFRunLoopRunSpecific + 470
27 GraphicsServices 0x00000001063169f0 GSEventRunModal + 161
28 UIKit 0x0000000103134420 UIApplicationMain + 1282
29 TooDooList 0x00000001024b1383 main + 115
30 libdyld.dylib 0x00000001052d7145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)


I have try to find a solution trough both googling it and read tutorials. If someone could help, I would be so glad. I am a newbie, so it could be a silly mistake. Thanks a lot! To help you out, here are some of my other codes:


XYZToDoListTableViewController.h:



#import <UIKit/UIKit.h>
#import "XYZToDoItem.h"

@interface XYZToDoListTableViewController : UITableViewController
- (IBAction)unwindToList:(UIStoryboardSegue *)segue;

@property XYZToDoItem *toDoItem;

@end


XYZAddToDoItemViewController.h:



#import <UIKit/UIKit.h>
#import "XYZToDoItem.h"

@interface XYZAddToDoItemViewController : UIViewController

@property XYZToDoItem *toDoItem;

@end


XYZToDoListTableViewController.m:



#import "XYZToDoListTableViewController.h"
#import "XYZToDoItem.h"
#import "XYZAddToDoItemViewController.h"

@interface XYZToDoListTableViewController ()

@property NSMutableArray *toDoItems;

@end

@implementation XYZToDoListTableViewController

- (void)viewDidLoad {
[super viewDidLoad];
self.toDoItems = [[NSMutableArray alloc] init];
[self loadInitialData];
}

- (void)loadInitialData {
XYZToDoItem *item1 = [[XYZToDoItem alloc] init];
item1.itemName = @"Buy butter";
[self.toDoItems addObject:item1];
XYZToDoItem *item2 = [[XYZToDoItem alloc] init];
item2.itemName = @"Bake Millie a cake";
[self.toDoItems addObject:item2];
XYZToDoItem *item3 = [[XYZToDoItem alloc] init];
item3.itemName = @"Order pizza";
[self.toDoItems addObject:item3];
}

- (IBAction)unwindToList:(UIStoryboardSegue *)segue;
{
XYZAddToDoItemViewController *source = [segue sourceViewController];
XYZToDoItem *item = source.toDoItem;
if (item != nil) {
[self.toDoItems addObject:item];
[self.tableView reloadData];

}

}



// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;


- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

// Return the number of rows in the section.
return [self.toDoItems count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"ListPrototypeCell" forIndexPath:indexPath];
XYZToDoItem *toDoItem = [self.toDoItems objectAtIndex:indexPath.row];
cell.textLabel.text = toDoItem.itemName;
if (toDoItem.completed) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;

}
return cell;
}


# pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
XYZToDoItem *tappedItem = [self.toDoItems objectAtIndex:indexPath.row];
tappedItem.completed = !tappedItem.completed;
[tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationNone];
}

@end


If you need more code, let me know. Thanks.




Why is Xcode crashing constantly?

I am unable to run any app on Swift, even blank projects. The moment I open a project, I get a message "swift quit unexpectedly". And on the error logs I see: Swift compile error Command failed due to signal: Segmentation fault: 11


I have no idea how to fix this... any ideas?




Amazon SNS publishing to Topic feedback

I am currently using Amazon SNS to publish push notifications to both Androids and iPhone devices using Topics.


I am having trouble in the scenario where if the APNS certificate is invalid, the Topic Publishing API does not provide any feedback or errors.


Hope someone have a solution to this.


Thanks in advance.




iOS - How to calculate time remaining for upload

I'm working on an application that allows the user to upload more files on the server. Items are displayed in a table and each cell has a progressbar and display informations regarding the current item status.


The client asks me to display information about all items in a single progress bar and also the time remaining until the end of the upload. The items are loaded from the gallery and are placed in a queue and then are sent to the server one by one. I have to work on the existing structure of the backend for this product.


I implemented, based on existing WS, show progress bar for all items but to display the time I need some help.


I have already tried the method proposed by Mzeeshaind : https://github.com/mzeeshanid/MZDownloadManager


This is the code :



switch (item.status){
case ENotifyFileUploadEvents_PROGRESS:
{
ProgressNotice* pn = (ProgressNotice*)(item.notice.args);

// Progress View
self.percentToShow = (self._itemsCount - self._itemsCountCompleted)+ pn.percentage;
self.progressView.progress = self.percentToShow/self._itemsCount;

self.lblStatusProgress.text = [NSString stringWithFormat:@"Uploading ... %0.2f %%", self.percentToShow/self._itemsCount*100];

UploadedItem *obj = [self.itemsToUpload objectAtIndex:self._itemsCount - self._itemsCountCompleted];
self.progressLabel.text =[NSString stringWithFormat:@"File Progress (%ld of %ld), %@", (self._itemsCount - self._itemsCountCompleted), self._itemsCount, obj.uploadWithFilename];

// Time Remaning - this code calculte time only for an item not for all
NSTimeInterval downloadTime = -1 * [self.uploadStartDate timeIntervalSinceNow];//self.uploadStartDate - NSDate initialized when user open the screen
float speed = pn.current / downloadTime;
unsigned long long remainingContentLength = pn.total - pn.current;

int remainingTime = (int)remainingContentLength / speed;

int hours = remainingTime / 3600;
int minutes = (remainingTime - hours * 3600) / 60;
int seconds = remainingTime - hours * 3600 - minutes * 60;

NSMutableString *remainingTimeStr = [[NSMutableString alloc] init];
if(hours>0)
[remainingTimeStr appendFormat:@"%d Hours ",hours];
if(minutes>0)
[remainingTimeStr appendFormat:@"%d Min ",minutes];
if(seconds>0)
[remainingTimeStr appendFormat:@"%d sec",seconds];

self.progressLabel.text = [NSString stringWithFormat:@"Time Left: %@",remainingTimeStr];

}


I need help to calculate the time remaining until the end of the upload for all items on the server.
Thanks in advance for your help.



Adding SKSpriteNode to constantly changing layer

Using swift, I'm trying to add a cup to a scene and then rotate, fade and shrink the cup about the screen's centre. I then want to add more cups to the scene which should then begin to shrink, fade and rotate. The way I am doing this at the moment is by creating a cup from 3 SKSpriteNodes, assigning physics bodies and appending each to another SKSpriteNode 'rotatingLayer'. rotatingLayer then rotates, shrinks and fades, but when I try to add another cup, the cup is placed upon the cups already in the scene, with the same size and rotation, so it doesn't look like anything has been added.


I'd like the next cup to be added at the original size and then immediately start to shrink and rotate, effectively chasing the already rotating cups.


My code:


override func didMoveToView(view: SKView) {

self.addChild(rotatingLayer)



rotatingLayer.position = CGPoint(x: screenWidth/2, y: screenHeight/2)

var rotate = SKAction.rotateByAngle(2 * 3.1415, duration: 5)
rotate = SKAction.repeatActionForever(rotate)

var fade = SKAction.repeatActionForever(SKAction.fadeAlphaTo(0, duration: 10))
var shrink = SKAction.repeatActionForever(SKAction.scaleTo(0, duration: 10))

var shrinkAndFade = SKAction.group([rotate, fade, shrink])

rotatingLayer.runAction(shrinkAndFade)

addCup()

}

func addCup()
{
let side1 = SKSpriteNode(imageNamed: "430x30.png")
side1.position = CGPoint(x: -side1.size.height/4 ,y: 0)
side1.zPosition = 1
side1.xScale = 0.5
side1.yScale = 0.5

side1.physicsBody = SKPhysicsBody(rectangleOfSize: side1.size)
side1.physicsBody?.dynamic = false


rotatingLayer.addChild(side1)

let side2 = SKSpriteNode(imageNamed: "430x30.png")
side2.position = CGPoint(x: side2.size.height/4 ,y: 0)
side2.zPosition = 1
side2.xScale = 0.5
side2.yScale = 0.5

side2.physicsBody = SKPhysicsBody(rectangleOfSize: side2.size)
side2.physicsBody?.dynamic = false


rotatingLayer.addChild(side2)

let base = SKSpriteNode(imageNamed: "30x430.png")
base.position = CGPoint(x: 0,y: -base.size.width/4)
base.zPosition = 1
base.xScale = 0.5
base.yScale = 0.5

base.physicsBody = SKPhysicsBody(rectangleOfSize: base.size)
base.physicsBody?.dynamic = false

rotatingLayer.addChild(base)
}


I'll be having some cups not rotating and some which will be, so I was hoping to use rotatingLayer as a constantly rotating, shrinking, fading layer which I can add cups to when they need to shrink, fade and rotate.


Can anyone help?


Thank you so much in advance.


Foot.




What is the drawback of not deleting inactive device tokens returned by APNS feedback service?

The obvious problem is I will be attempting to send push to inactive devices that won't receive push anyway, therefore wasting my traffic and possibly degrading performance.


But let's say I am willing to temporarily live with this because I need to fix other issues first. Is this OK? I am worried Apple may cut you off if you don't take care of it and keep trying to send push to non-existent devices. More specifically, I don't know how to interpret this sentence in their documentation:



APNs monitors providers for their diligence in checking the feedback service and refraining from sending remote notifications to nonexistent apps on devices.



(https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3)




insertSubviewAtIndex changing view transformation and center

I have multiple UIViews stacked together, and I'm calling insertSubviewAtIndex and it causes all the transformations and center to change from what they should be. When I don't have insertSubviewAtIndex it works (but the view hierarchy isn't what I want). The problem happens with any view method for changing the view hierarchy. Any ideas on how to fix? Thanks




How to create a iAd banner?

I'm still a noob developper and I just finished my little game and now I want to integrate AdBanner.


With the code bellow the banner doesn't appear on the screen.


Someone can help me ?


Here my GameViewController code :



import UIKit
import SpriteKit
import AVFoundation
import iAd

var defaults = NSUserDefaults()
var highscore = defaults.integerForKey("highscore")


class GameViewController: UIViewController, ADBannerViewDelegate {

var bannerView:ADBannerView?


override func viewDidLoad() {
super.viewDidLoad()

self.canDisplayBannerAds = true
self.bannerView?.delegate = self
self.bannerView?.hidden = true

var skView = self.originalContentView as SKView
var scene:SKScene = GameScene(size: skView.bounds.size)

skView.showsFPS = false
skView.showsNodeCount = false
skView.showsPhysics = false

let turbulence = SKFieldNode.turbulenceFieldWithSmoothness(0.1, animationSpeed: 0.1)
scene.addChild(turbulence)
let noise = SKFieldNode.turbulenceFieldWithSmoothness(0.4, animationSpeed: 0.1)
scene.addChild(noise)

skView.presentScene(scene)

}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Release any cached data, images, etc that aren't in use.
}

func bannerViewDidLoadAd(banner: ADBannerView!) {
self.bannerView?.hidden = false
}

func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return willLeave
}

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
self.bannerView?.hidden = true
}

override func prefersStatusBarHidden() -> Bool {
return true
}
}


screenshot




What is the max height a keyboard can be in iOS?

Now that iOS8 has introduced custom keyboards, what is the max height that a keyboard can be? Can it potentially take up the whole screen or is there a limit to the height?




API or Framework that can look up UPC's and retrieve product information for IPhone

Like the title says I'm looking for an API or framework that I can send a UPC out and retrieve product information back.




IBoutlets nil in swift when using storyboards

In one of my ViewControllers, when I get to viewWillAppear, all my IBOutlets are nil, I tried looking at @matt`s solution but it works for nibs not in Storyboards.


This is only a problem when I run the app on devices that are on iOS 7. It doesn't happen on other devices.


Does anyone know why all my IBOutlets in that viewController is nil (notice that other viewControllers works fine.)


Edit: Tried creating a new ViewController in the storyboard, with some labels, and a new TestViewController.swift file, and connecting them, still getting nil values, please understand that the rest of the project works just fine.




Cannot change UIView background color and UILabel text color in iOS 8

I've looked at many posts and none seem to help with the current issue I'm experiencing. I am trying to change the UIView background color and UILabel text color programmatically on a button click. They are all connected in the interface builder. What I did was open the ViewController.h file next to the Main.storyboard and clicked and dragged to connect the view (backgroundView) and label (letterR).


If anyone can see what I am doing wrong that would be great thanks!


ViewController.h



#import <UIKit/UIKit.h>

@interface ViewController : UIViewController{

IBOutlet UIView *backgroundView;
IBOutlet UILabel *letterR;
}

@end


ViewController.m



#import "ViewController.h"

@interface ViewController ()
@end

@implementation ViewController

static int flag = 0;

- (void)viewDidLoad {
[super viewDidLoad];
}

- (IBAction)ButtonClick:(id)sender {

if(flag == 0){

flag = 1;
letterR.textColor = [UIColor blackColor];
backgroundView.backgroundColor = [UIColor whiteColor];
}

else if(flag == 1){

flag = 0;
letterR.textColor = [UIColor whiteColor];
backgroundView.backgroundColor = [UIColor colorWithRed:0 green:1 blue:1 alpha:1];
}
}

@end


When monitoring the NSLog output of the label and background this is what I am getting:


Letter R: 2014-11-26 15:18:18.358 Rave[3923:340203] Letter R: >


Printing the color of the letter:(null)


Background: 2014-11-26 15:18:18.358 Rave[3923:340203] Background: >


Printing the color of the background:2014-11-26 15:23:13.467 Rave[3962:342332] Background Color: UIDeviceRGBColorSpace 0 1 1 1


Also the background color is being modified just not updated on screen of the simulator.




No access to photos of people, if displayedProperties was defined

If a mail want to select from a person in the address book and only the mail properties should be visible, so I can define by the property displayedProperties of the class ABPeoplePickerNavigationController.


bookNavi.displayedProperties = [NSNumber(int: kABPersonEmailProperty)]


If I want to copy the image of the person after the selection, I need following function:



var imageData:NSData?
if ABPersonHasImageData(person) {
imageData = ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatThumbnail).takeRetainedValue()
}


And now to the question. If displayedProperties is defined, then the function ABPersonHasImageData returns false. If displayedProperties is not defined, then the function returns true. But the other properties like kABPersonFirstNameProperty or kABPersonLastNameProperty are always not null. How can I define the properties and query the profile picture?




Determine if app is running in "scaled" mode on iPhone 6 for keyboard?

I'm trying to create a custom iOS 8 keyboard. I am using Interface Builder to arrange the keyboard layout. I have two NIB files, one for iPhone 6 and one for iPhone 5.


There are certain apps that are "scaled" up for the iPhone 6. For these apps, I want to load the iPhone 5 NIB (the iPhone 6 NIB goes off the screen).


Is there any way to determine if the current app running is running on "scaled" mode?


Unfortunately checking UIScreen mainScreen's attributes does not give me a difference between native iPhone 6 app vs scaled iPhone 6 app.




Checking if a key in standardUserDefaults has been set or is NSNull

What is the correct way to check the contents of standardUserDefaults ?


If I print out what is stored in a key i get:



NSLog(@"logged_in_status : %@", [standardUserDefaults stringForKey:@"logged_in_status"]);
Output: logged_in_status : (null)


So it seems to be NSNull.


So I will add a check for that as follows:



if ([[standardUserDefaults objectForKey:@"logged_in_status"] isKindOfClass:[NSNull class]])
{
NSLog(@"YES");
}
else
{
NSLog(@"NO");
}


Output: NO


Why does this not resolve to the YES? Isn't it an NSNull?


I've been looking at this for a long time and can't see where the error is. Could anybody kindly explain where I've gone wrong on this?


Thanks, Code




Collapse or expand UIView using UIPanGestureRecognizer in iOS

I want to expand and collapse multiple UIView using UIPanGestureRecognizer.


For reference you can see this link: https://itunes.apple.com/us/app/fleck-the-bigger-picture/id619977675?mt=8


I have used facebook pop library on github : https://github.com/facebook/pop. Uding this I am able to expand and collapse using POPSpringAnimation. But the problem is that I want to expand or collapse UIView as user pan i.e one view will collapse and other will expand.


Is there any library using which I can do this stuff?




Using prepareForSegue in Swift

I'm trying to create a Segue when tapping on a UIView that causes a segue to a new view controller that holds the UIView that was tapped on. Basically taking a UIView that was only half the screen and making it the size of the whole screen.


I think I should use prepareForSegue to pass the UIView I tapped on to the new view controller, rather than create a new view, but I'm not sure if prepareForSegue should be autogenerated, and where it should be. I linked the tap gesture to a "Show" segue that opens the new view controller. I thought that prepareForSegue was auto-generated in Objective-C, so I'm not sure if I should be using it or not.


Another thought is that it could be in the tap gesture's action function, but I'm not sure if this is better or worse than prepareForSegue. The problem I see with that is there is no way to get a reference to the new view controller I'm moving to.




How cam I make the Camera View to open faster?

I use the iOS CameraViewController TGCameraViewController. It works great. My problem is that the camera view (i.e., when you run the example and hit the "capture image" button) view takes a very long time to be initialized and ready for the user. The AVFoundation is used.


Is there a way to make the camera view appear much faster in the state where the user can capture a photo?


Edit:


I initialized the ViewController right before I need it. The controller is called by a Cordova method call as follows:



-(void) openCamera:(CDVInvokedUrlCommand *)command {

TGCameraNavigationController *navigationController = [TGCameraNavigationController newWithCameraDelegate:self];
UIViewController *rootVC = [[UIApplication sharedApplication] delegate] window] rootViewController];
[rootVC presentViewController:navigationController animated:YES completion:nil];

}


Edit:


Here is what I did:



// Cordova command method
-(void) init:(CDVInvokedUrlCommand *)command {

[TGCamera setOption:kTGCameraOptionSaveImageToAlbum value:[NSNumber numberWithBool:YES]];

_navigationController = [TGCameraNavigationController newWithCameraDelegate:self];
_rootVC = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
}

// Cordova command method
-(void) openCamera:(CDVInvokedUrlCommand *)command {

[_rootVC presentViewController: _navigationController animated:YES completion:nil];
}


I set up a part of the ViewController in an init method which is called only once when the app starts. Then when the user clicks on the take photo button in call openCamera. The problem is that this does not speed up the launch.


I tried the sample app from TGCameraViewController on iPhone5 and it takes a bit longer than the native camera app. This is exactly the problem I want the sample app to be as fast as the native camera app.


Is there a better way to speed up the launch of the camera?




Running Location services with iOS 7sdk build on iOS 8.1 device

Apparently in iOS 8 SDK, requestAlwaysAuthorization (for background location) or requestWhenInUseAuthorization (location only when foreground) call on CLLocationManager is needed before starting location updates.


There also needs to be NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription key in Info.plist with a message to be displayed in the prompt.


But if I build with iOS 7 sdk, do I need to make these changes for running location services on iOS 8 device? (I know how to run on iOS 8 device with iOS 7 sdk. Hack -I just need to keep the device plugged with xcode 6 also open and then I start xcode 5. It detected iOS 8 device on xcode 5.1)




iOS / Amazon Web Services - AWSS3GetObjectRequest ifModifiedSince NOT WORKING

Building for iOS 7+ , Building on Xcode 6.1 , Using Amazon SDK AWSiOSSDKv2 2.0.12 , Testing on iPhone 5s and iPad 2


I am downloading images from my Amazon S3 bucket with the Amazon SDK for iOS. The downloading is working fine but I want to use the ifModifiedSince property to retrieve only images that have been modified since a certain date (see http://docs.aws.amazon.com/AWSiOSSDK/latest/Classes/AWSS3GetObjectRequest.html#//api/name/ifModifiedSince )


However, this is not working. Even when I specify a ifModifiedSince date that is LATER THAN the modified date of the file on S3, the file is returned.


According to the Amazon documentation: ifModifiedSince -



Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).



So I am not sure if I am doing something wrong or Amazon has a bug in the SDK.


Here is my code:



-(void)downloadPhotoWithName:(NSString*)name completed:(retrievedImage)completed {



NSFileManager *manager = [NSFileManager defaultManager];
NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cacheDirectory = [cachePaths firstObject];
NSString *filename = [NSString stringWithFormat:@"%@.jpg", name];
NSString *filePath = [cacheDirectory stringByAppendingPathComponent:filename];


AWSS3 *transferManager = [AWSS3 defaultS3];
AWSS3GetObjectRequest *profilePhoto = [[AWSS3GetObjectRequest alloc] init];
profilePhoto.bucket = S3BUCKETNAMEIMAGE;
profilePhoto.key = filename;



if ([manager fileExistsAtPath:filePath isDirectory:NULL]) {

NSDictionary *att = [manager attributesOfItemAtPath:filePath error:nil];

if (att) {

//Get the date of when the file was modified so we can request to retrieve
//the file only if it was modified SINCE that date

NSDate *modifiedDate = [att objectForKey:NSFileModificationDate];

if (modifiedDate) {
profilePhoto.ifModifiedSince = modifiedDate;
}

}


}


[[transferManager getObject:profilePhoto] continueWithBlock:^id(BFTask *task) {


//If it was working we should get a 304 not the image file
if (task.result) {


AWSS3GetObjectOutput *output = (AWSS3GetObjectOutput*)task.result;
NSData *imageData = (NSData*)output.body;


if (imageData) {


NSDictionary* attr = [NSDictionary dictionaryWithObjectsAndKeys:output.lastModified, NSFileModificationDate, NULL];

//The log confirms that the date I am passing for ifModifiedSince is LATER THAN
//the last modified date of the file on S3
//but the the image file is returned anyway.. is it a problem with Amazon ?

NSLog(@"output.lastModified: %@\nmodifiedDate: %@", output.lastModified, profilePhoto.ifModifiedSince);

if ([manager createFileAtPath:filePath contents:imageData attributes:attr]) {

completed(imageData);

}
else {

NSLog(@"Could not save image to disk for some reason");
completed(nil);

}



}
else {



completed(nil);
}



}
else if (task.error) {
NSLog(@"DownloadPhotoError: %@", task.error);

completed(nil);
}



return nil;
}];

}



How do not turn off the display with proximity sensor in iOS

i want to intercept the proximity sensor without turn off the display.


i know by the documentation that i have only boolean var:


Using the Proximity Sensor:



proximityMonitoringEnabled
proximityState


this code



[UIDevice currentDevice].proximityMonitoringEnabled = YES;


intercept the face, but do not turn off the display. It's possible to turn on the display with the sensor covered?


Thanks all




Swift Function with multiple parameters

I can't seem to figure out whats the issue here,


I have a swift code and I need it to gather multiple parameters. Please help:



func myBioData(myNameIs, myAgeIs) {
println("Hello, my name is (myNameIs) and I am (myAgeIs) years old");
}



Resizing the height of UILabel to fit text

I have UILabel in my Cell Subclass which is suppose to hold a title. The size of the title can be various lengths and therefor i need to resize the UILabel to fit the text and to prevent that the text is not to long i also need to be able to set maxHeight. The width should be the same. How can i create such code in swift in a tableViewCell subclass.


so far i have this in awakeFromNib



theTitleLabel?.font = UIFont(name: "HelveticaNeue", size: 13)
theTitleLabel?.textColor = UIColor(rgba: "#4F4E4F")
theTitleLabel?.numberOfLines = 0
theTitleLabel?.lineBreakMode = NSLineBreakMode.ByTruncatingTail



ios 8 uitableview stuck/hang/freeze when scrolling to the end of table

I really need helps from you. I'm trying to load some data (about 50 records) to UITableView. But it got frozen/hang while scrolling to the end of the tableview. I did try to log which row is displaying. When I scroll down, the log show the row 1... 49 is display then it starts over with row 42.


This is the .h file:



@interface VDevicesViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>
{
NSString* access_token;
NSMutableArray* data;
NSMutableArray* deviceNotGoodData;
NSArray* _deviceTypeList;
NSArray* _thumnailArray;
DAPagesContainer* pageContainter;
UITableView* tableAllDevices;
UITableView* tableNotGoodDevices;

int currentPage;
UIView * footerView;
UIActivityIndicatorView* indicator;
}
@property (strong, nonatomic) IBOutlet UIView *myView;

-(void)refresh;
@end


this is the .m file



- (void)viewDidLoad
{
[super viewDidLoad];
CGRect screenRect = [[UIScreen mainScreen] bounds];
[self.myView setFrame:CGRectMake(0, 32, screenRect.size.width, screenRect.size.height)];

// Do any additional setup after loading the view
data = [[NSMutableArray alloc] init];
deviceNotGoodData = [[NSMutableArray alloc] init];
pageContainter = [[DAPagesContainer alloc] init];
[pageContainter setPageIndicatorImage:[UIImage imageNamed:@"up_arrow_gray"]];
[pageContainter setTopBarBackgroundColor:[UIColor colorWithRed:24.0f/255.0f green:177.0f/255.0f blue:214.0f/255.0f alpha:1]];
pageContainter.pageItemsTitleColor = [UIColor whiteColor];

[pageContainter willMoveToParentViewController:self];
pageContainter.view.frame = self.myView.bounds;
pageContainter.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
CGFloat width = self.myView.frame.size.width;
CGFloat height = self.myView.frame.size.height - 50;
CGRect tableFrame = CGRectMake(0, 0, width, height);
UIViewController* allDeviceContoler = [[UIViewController alloc] init];
tableAllDevices = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain];
tableAllDevices.delegate = self;
tableAllDevices.dataSource = self;
tableAllDevices.tag = 0;

NSString* allDeviceTitle = [NSString stringWithFormat:@"All Devices(%@)", [[NSUserDefaults standardUserDefaults] valueForKey:KEY_DEVICES_USED]];
allDeviceContoler.title = allDeviceTitle;
[allDeviceContoler.view addSubview:tableAllDevices];

UIViewController *notGoodDevicesControler = [[UIViewController alloc] init];
tableNotGoodDevices = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain];
tableNotGoodDevices.delegate = self;
tableNotGoodDevices.dataSource = self;
tableNotGoodDevices.tag = 1;

NSString* uncompliantDevices = [NSString stringWithFormat:@"With Issues(%@)", [[NSUserDefaults standardUserDefaults] valueForKey:KEY_DEVICES_UNCOMPLIANT]];
notGoodDevicesControler.title = uncompliantDevices;
[notGoodDevicesControler.view addSubview:tableNotGoodDevices];

[self.myView addSubview:pageContainter.view];
[pageContainter didMoveToParentViewController:self];
pageContainter.viewControllers = @[allDeviceContoler, notGoodDevicesControler];
currentPage = 1;
access_token = [[NSUserDefaults standardUserDefaults] valueForKey:TOKEN_ACCESS_KEY];
_deviceTypeList = [NSArray arrayWithObjects:@"desktop", @"laptop", @"phone", @"tablet", @"server", @"router", @"switch", @"vm", nil];

_thumnailArray = [NSArray arrayWithObjects:@"device_desktop_small", @"device_laptop_small", @"phone", @"tablet", @"device_server_small", @"router", @"switch", @"device_vm_small", nil];

[self GetDevices:[NSNumber numberWithInt:currentPage]];
indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(screenRect.size.width/2.0, 40, 37, 37)];
[indicator startAnimating];

[self.myView addSubview:indicator];
}

#pragma mark - TableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (tableView.tag == 0) {
return [data count];
}
else if (tableView.tag == 1)
return [deviceNotGoodData count];
return 0;
}

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString* cellIdentitifier = @"TableCell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentitifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentitifier];

}

NSArray* flexData;
if (tableView.tag == 0) {
flexData = [NSArray arrayWithArray:data];
}
else
flexData = [NSArray arrayWithArray:deviceNotGoodData];


if (flexData.count > 0) {
if (indexPath.row < ([flexData count])) {
// add data here
NSLog(@"%ld", (long)indexPath.row);
VDeviceObject * deviceObject = [flexData objectAtIndex:(indexPath.row)];
cell.textLabel.text = deviceObject.hostname;
cell.detailTextLabel.text = deviceObject.username;
cell.detailTextLabel.textColor = [UIColor colorWithRed:180.0f/255.0f green:180.0f/255.0f blue:180.0f/255.0f alpha:1];

if ([deviceObject.numberOfIssues intValue] > 0) {
cell.backgroundColor = [UIColor colorWithRed:247.0f/255.0f green:247.0f/255.0f blue:247.0f/255.0f alpha:1];
}

cell.imageView.image = [UIImage imageNamed:[_thumnailArray objectAtIndex:[deviceObject.deviceType intValue]]];
}
}

return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier: @"ViewDetail" sender:indexPath];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 65;
}
-(void)GetDevices:(NSNumber*)page {
if (access_token == nil || [access_token isEqualToString:@""]) {
return;
}
NSError* error;
NSData * devicesData = [VTabBarViewController sendSyncGetRequest:[NSString stringWithFormat:@"%@?access_token=%@&limit=%@&GroupBy=issues&page=%@", GEARS_API_GET_DEVICES, access_token, @"50", page] errorCode:error];

NSString* errorString = [[NSString alloc] initWithData:devicesData encoding:NSUTF8StringEncoding];
NSString* stringCode = @"Requested page number exceeds limit";
if ([errorString rangeOfString:stringCode].location != NSNotFound) {
return;
}
NSMutableArray* list = [NSJSONSerialization JSONObjectWithData:devicesData options:NSJSONReadingAllowFragments error:&error];
for (int i = 0 ; i<[list count]; ++i) {
NSDictionary *dict = [list objectAtIndex:i];
NSString* hostName = [dict objectForKey:@"hostname"];
NSString *machine_type = [dict objectForKey:KEY_MACHINE_TYPE];
NSNumber* numberIssues = [dict objectForKey:KEY_TOTAL_ISSUE];
NSDictionary *userinfo = [dict objectForKey:KEY_USER_INFO];
NSString* username = [userinfo objectForKey:KEY_USER_NAME];
NSString* hwid = [dict objectForKey:KEY_HWID];
VDeviceObject *object = [[VDeviceObject alloc] init];
object.username = username;
object.deviceType = [self deviceType:machine_type];
object.numberOfIssues = numberIssues;
object.hostname = hostName;
object.hardwareId = hwid;

[data addObject:object];
if ([object.numberOfIssues intValue] > 0) {
[deviceNotGoodData addObject:object];
}
}
NSLog(@"On page: %d", currentPage);
//[tableAllDevices reloadData];
//[tableNotGoodDevices reloadData];
}


This is the gif image to demonstrate the problem I've got (I did try to reduce the size but its quality is so bad) http://s934.photobucket.com/user/quocvinh_2009/media/TableView%20Bug.gif.html


Thank you...


Update: I try to add 'UITableView' by storyboard, connect with the 'IBOutlet', it works. So maybe I did something wrong with the table :(




Mobile Website Jquery issue on Safari (Iphone)

There is some problem with jquery I think when I visit the mobile website from an Iphone. It works fine from any other device such as, Ipad, Samsung etc.


The problem is in the Album page. if you click to any album from the main then try to scroll down in the next page you will see the problem with iphone.


The link to the mobile website: http://tinyurl.com/nwpxhgl


Does anyone know what the problem?


Regards




Custom transition between UIControllers does not work

I have object that manage custom transition:



@interface NavigationManager : NSObject <UIViewControllerAnimatedTransitioning>

-(NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext;
-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext;

@property (nonatomic, assign) NSTimeInterval presentationDuration;
@property (nonatomic, assign) NSTimeInterval dismissalDuration;
@property (nonatomic, assign) BOOL isPresenting;


@end

@interface NavigationManager()

@property (nonatomic, strong) id<UIViewControllerContextTransitioning> transitionContext;

@end

@implementation NavigationManager

@synthesize presentationDuration, dismissalDuration, isPresenting;

-(id)init{
self = [super init];

if(self){

self.presentationDuration = 1.0;
self.dismissalDuration = 0.5;
}

return self;
}

-(NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext{

return self.isPresenting ? self.presentationDuration : self.dismissalDuration;
}

-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{


self.transitionContext = transitionContext;
if(self.isPresenting){
[self executePresentation:transitionContext];
}
else{

[self executeDismiss:transitionContext];
}

}

...


@end


And in class that should process implement transitions:

@interface ViewController : UIViewController <UIViewControllerTransitioningDelegate>

@property (nonatomic, strong) NavigationManager navigationManager;

..

@end

@implementation

...


//Here I`m doing navigation to new UIViewController



- (void)navigateToNewScreen
{
DetailedNewsController *secVC = [[DetailedNewsController alloc] init];
secVC.fullDescription = fullDescription;
secVC.headerImage = a.imageView.image;
self.transitioningDelegate = self;
[self.navigationController pushViewController:secVC animated:YES];
}

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
presentingController:(UIViewController *)presenting
sourceController:(UIViewController *)source
{
self.animationController.isPresenting = YES;
return self.animationController;
}

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
self.animationController.isPresenting = NO;
return self.animationManager;
}

@end


Default animation of transitioning is performed. Also navigation controller bar is not displayed after navigation.




Download file on iOS

I want to download file from a UIWebView on iOS.


I have tried somes things but it always download only 42Ko.


Any ideas?


Thanks




iOS 6 bluetoothmanager pairing private api

I'm trying to communicate with a 3rd party bluetooth device from an iPhone 4s with iOS6, and using a bluetooth headset as an example. After checking many guides and tutorials on the subject, I came to the following conclusions:


a -The most suitable way for me to make communication work is to use "IOS bluetoothManager private framework". (I don't need to upload it to app store)


b - The steps are:



  1. Find the device

  2. Get his info (address)

  3. pair

  4. communicate


c - Apparently there is no way to make it work :(


I based my app on this: Bluetooth and iOS – Use Bluetooth in your iPhone apps, and wrote my app based on it.


When I run it, the app finds the headset device


xcode output console:



2014-11-30 14:31:57.041 BluetoothNew[146:907] BTM: attaching to BTServer
2014-11-30 14:31:57.050 BluetoothNew[146:907] BTM: enabling device scanning
2014-11-30 14:32:00.451 BluetoothNew[146:907] BTM: found device "UA06XB-B" 20:14:05:12:7A:3B
2014-11-30 14:32:00.454 BluetoothNew[146:907] Name: UA06XB-B
Address: 20:14:05:12:7A:3B
MajorClass: 1024
MinorClass:4
Type:16
BatteryLevelSupport:0


When I try to pair to the device I get the following message in xcode console:



2014-11-30 14:32:04.686 BluetoothNew[146:907] BTM: setting pincode '0000' for device "UA06XB-B" 20:14:05:12:7A:3B
2014-11-30 14:32:04.688 BluetoothNew[146:907] BTM: connecting to device "UA06XB-B" 20:14:05:12:7A:3B
2014-11-30 14:32:07.303 BluetoothNew[146:907] BTM: attempting to connect to service 0x00000001 on device "UA06XB-B" 20:14:05:12:7A:3B
2014-11-30 14:32:07.938 BluetoothNew[146:907] BTM: connection to service 0x00000001 on device "UA06XB-B" 20:14:05:12:7A:3B failed with error 158


connection code:



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = (UITableViewCell*)[tableView cellForRowAtIndexPath:indexPath];
NSString *labelText = cell.textLabel.text;

BluetoothDevice *device = [self.currentAvailableDevices objectForKey:labelText];
BluetoothManager *btManager = [[self bluetoothScanner]getBluetoothManager];
[btManager setPincode:@"0000" forDevice:(device)];
[btManager connectDevice:device];


// I tried this way too with the same result

//[device setPIN:@"0000"];
//[device connect];
//NSLog(@"service supported: %d", [device isServiceSupported:0x00000001]);
}


What is the problem? What is error 158?


Any help would be appreciated.


Slava.




Intel XDK iphone build fail

Web app and android builds are working fine. but the ios build ends with a



An unexpected error occured while attempting to build the application.


on the summary screen. Going into the build log, it says



** BUILD SUCCEEDED **

Command finished with error code 0: .../Nuro Block Chain Netbanking/platforms/ios/cordova/build --device


Here are links to the full logs:


Build log: http://pastebin.com/Cwuru6bS


Summary log: http://pastebin.com/pmBxbnwF


Source code: http://github.com/urocoin/nuro-intel-xdk