lundi 11 mai 2015

Sharing classes between existing iPhone project and Watch Kit extension

I would like to share a class "MyClass" that I added as target to an iPhone project to which I then added a Watch Kit extension target.

Whenever I import the "MyClass" in the Watch Kit extension source code I get:

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_MyClass", referenced from: objc-class-ref in WKMyInterfaceController.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any idea on how to solve this? It seems a linker problem so I guess I have to add the source code of the class MyClass to the linked libraries/headers of the WatchKit Extension app but I am not sure if there is a better way to do it.

Parse a XML file in a specified format iOS

Is there anyway through through which I can parse this XML file that is in this following format:-

<?xml version="1.0" encoding="utf-8"?>
<CountryList>
  <Country CountryId="AF">Afghanistan</Country>
  <Country CountryId="AX">Akrotiri</Country>
  <Country CountryId="AL">Albania</Country>
...........................................
...........................................

I need the Country ID and the name:- i.e "AL" and "Albania" , So, is it possible to parse specified XML, and store Country Id and country name in an Array. Any suggestion will be helpful.

I need to find the data from lynda dot com app on iphone 6

Where does iPhone 6 stores the application data from lynda.com app? can someone please help. I tried looking under /applications but it is not there. By the way i am using Ifile

Thanks for your help!

How to create an image view for image when image is added to imageview

the attached screenshot is the description of my problem. i have a problem to add multiple images to image view.

enter image description here

how to create dropdown with "Other" option in ios

i am using objective c with xcode 6. i want to create a drop down where user can select the source who told him about my app.

options are "Tv","Facebook","Google","Print Media","other".

if he selects other he should be able to write the other source.

can any body help?

compiler error in using Zbar SDK(library) in xcode 6

1 I got the following error while building my project.

Undefined symbols for architecture i386: "_OBJC_CLASS_$_ZBarCaptureReader", referenced from: objc-class-ref in ZBarViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) .I have try all kinds of solution form google but unable to solve it . Help will be appreciated Thanks Screen Shot Attached

watch kit showing the updated data from the server

The scenario is.

1) I have already existing iOS app for iPhone device. The application is showing the real time data in dashboard page. The data on Dashboard is updated after every 60 sec by calling the web services from iOS app.

2) I want to develop the apple watch application based on same iPhone app Which will show the dashboard with data updating after every 60 seconds.

How to achieve this. Any suggestions are highly appreciated. Thanks.

UIWebView first request too slow

I am using UIWebView to render web content in my application. I observed that the initial request when the app launches i.e. loadRequest, takes a long time to render the contents. However the subsequent requests which I don't track of, are much faster.
To confirm this, I created a standalone application which just has a UIWebView. This is the single line of code which I have added :

[wkBrowser loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.yahoo.com"]]];

The result is same. It takes around 15-20 seconds to load the page. However on tapping any link on web page, it takes 3-5 seconds to load the next page. I did put the UIWebView delegate function didFailLoadWithError, but there is never an error.
Question:

  1. Why is the first web request so slow ?
  2. How may I make it faster other than caching ?

how to create invoice using ApI in ios

I tried to create invoice of paypal using the follwing url invoiceurl

I wrote the following code

 NSURL *url = [NSURL  URLWithString:@"http://ift.tt/1rqEcHT"];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSData *requestData = [NSData dataWithBytes:[jsonString UTF8String] length:[jsonString length]];

[request setHTTPMethod:@"POST"];
[request setValue:@"sender_ssa_api1.gmail.com" forHTTPHeaderField:@"X-PAYPAL-SECURITY-USERID"];
[request setValue:@"AYL24E5YABQJ7S3Q" forHTTPHeaderField:@"PAYPAL-SECURITY-PASSWORD"];
[request setValue:@"A9kCtldabx3cNH-JvrasyD5dOesXAF61m6tDSZ.A7OCniSLwPFV0-A5e" forHTTPHeaderField:@"X-PAYPAL-SECURITY-USERID"];
[request setValue:@"APP-80W284485P519543T" forHTTPHeaderField:@"X-PAYPAL-APPLICATION-ID"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];

[NSURLConnection connectionWithRequest:request delegate:self];
}

- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
 NSMutableData *d = [NSMutableData data];
 [d appendData:data];

NSString *a = [[NSString alloc] initWithData:d encoding:NSASCIIStringEncoding];

NSLog(@"Data: %@", a);
}

I got authentication error. Please help me how to do it in ios.

thanks inadvance

dealing with different screen sizes in xcode

I have an iPhone game that was first developed for iPhone 6 and when played on the iPhone 5 sim it works fine but when played on the iPhone 4 sim the sides are stretched out?!? and the nodes that I spawn in from the left and the right side spawn on the screen instead of off the screen like on the iPhone 6 and 5. (please don't say this is a duplicate as I have been looking for weeks of how to deal with different iPhones)

I have arrows coming in the from the left and the right that spawn randomly on the y axis. They spawn off screen then slowly move on screen than move quickly across the screen but on the iPhone 4 the arrows spawn on the screen. this is the code for one of the arrows

-(void) leftArrow
{
    int randomY = arc4random() % (675 - 175);
    int yPoint = randomY + 175;
    leftArrow = [SKSpriteNode spriteNodeWithImageNamed:@"arrow"];

    leftArrow.size = CGSizeMake(leftArrow.size.width/1.2, self.frame.size.height/22);
    leftArrow.position = CGPointMake(CGRectGetMidX(self.frame) - 230, yPoint);
    leftArrow.zPosition = 50;
    leftArrow.alpha = 1;

    SKAction* action1 = [SKAction moveToX:leftArrow.position.x + 30 duration:0.5];
    SKAction* wait = [SKAction waitForDuration:0.75];
    SKAction* action2 = [SKAction moveToX:leftArrow.position.x + 470 duration:1.5];
    SKAction* sequence = [SKAction sequence:@[action1,wait,action2,destroy]];

    [self addChild:leftArrow];
    if (deadDown == 1 || deadUp == 1 || didIntersect == true)
    {
        [leftArrow runAction:destroy];
    }
    else
    {
        [leftArrow runAction:sequence completion:^{
            if (ii != 1)
            {
                if (didIntersect != true)
                {
                    score++;
                    if (score == 100)
                    {
                        backgroundScore.fontSize = 300;
                        backgroundScore.position = CGPointMake(backgroundScore.position.x, backgroundScore.position.y + 30);
                }
                strFromInt = [NSString stringWithFormat:@"%d",score];
                backgroundScore.text = strFromInt;
                }
            }
        }];
    }
}

I am also using this in my didmovetoview function

self.scaleMode = SKSceneScaleModeAspectFill;

How to form ticket fare ascending and descending order form array in objective c

My Array Values are

20, 30, 25, 50, "600/500", "410/360"

Thanks in advance

Get Favourite Marked Tweets Updated Date

I am integrating Twitter in an iOS app. The functionality is that i have to get all tweets that are marked favorite within last 24 hours.

I am using "STTwitterAPI" library for getting tweets.

Here is my request:-  
 `STTwitterAPI *twitter = [STTwitterAPI twitterAPIWithOAuthConsumerKey:@"ConsumerKey" consumerSecret:@"consumerSecret" oauthToken:@"oauthToken" oauthTokenSecret:@"oauthTokenSecret"];
`

`[twitter getFavoritesListWithUserID:nil screenName:nil count:nil sinceID:nil maxID:nil includeEntities:nil successBlock:^(NSArray *statuses){
  NSLog(@"%@",statuses);
}
`

So thats how i am requesting for favourites tweets.
The response coming is that:-

`
contributors = "<null>";
    coordinates = "<null>";
    "created_at" = "Mon May 11 06:20:03 +0000 2015";
    entities =     {
        hashtags =         (
        );
        symbols =         (
        );
        urls =         (
        );
        "user_mentions" =         (
        );
    };
    "favorite_count" = 1;
    favorited = 1;
    geo = "<null>";
    id = xxxxxxxxxxxxxxxxxxxxx;
    "id_str" = xxxxxxxxxxxxxxxxxxxxx;
    "in_reply_to_screen_name" = "<null>";
    "in_reply_to_status_id" = "<null>";
    "in_reply_to_status_id_str" = "<null>";
    "in_reply_to_user_id" = "<null>";
    "in_reply_to_user_id_str" = "<null>";
    lang = en;
    place = "<null>";
    "retweet_count" = 0;
    retweeted = 0;
    source = "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>";
    text = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    truncated = 0;
    user =     {
        "contributors_enabled" = 0;
        "created_at" = "Mon Apr 13 12:15:45 +0000 2015";
        "default_profile" = 1;
        "default_profile_image" = 1;
        description = "";
        entities =         {
            description =             {
                urls =                 (
                );
            };
        };
        "favourites_count" = 56;
        "follow_request_sent" = 0;
        "followers_count" = 0;
        following = 0;
        "friends_count" = 2;
        "geo_enabled" = 0;
        id = xxxxxxxxxxxxxxxxxxxxx;
        "id_str" = xxxxxxxxxxxxxxxxxxxxx;
        "is_translation_enabled" = 0;
        "is_translator" = 0;
        lang = en;
        "listed_count" = 0;
        location = "";
        name = "xxxxxxxxxxxxxxxxxxxxx";
        notifications = 0;
        "profile_background_color" = C0DEED;
        "profile_background_image_url" = "http://ift.tt/1eDsrLj";
        "profile_background_image_url_https" = "http://ift.tt/1dEhDZS";
        "profile_background_tile" = 0;
        "profile_image_url" = "http://ift.tt/1hc50JK";
        "profile_image_url_https" = "http://ift.tt/18sbEJA";
        "profile_link_color" = 0084B4;
        "profile_sidebar_border_color" = C0DEED;
        "profile_sidebar_fill_color" = DDEEF6;
        "profile_text_color" = 333333;
        "profile_use_background_image" = 1;
        protected = 0;
        "screen_name" = "xxxxxxxxxxxxxxxxxxxxx";
        "statuses_count" = 11;
        "time_zone" = "<null>";
        url = "<null>";
        "utc_offset" = "<null>";
        verified = 0;
    };
`



I am getting all the favorite marked tweets but i am getting their created date only. Is there ant way so that i can also find their favorite marked time and date too????

Suppose i ahev a tweet that i have created 3 months ago. Now i marked him favourite 30 mins ago. So the time that i require is 30 mins previous to current time not the time 3 months ago. Is there any Suggestions???

Please Reply Soon....

Thanks...

how to update UILabel using sockets

I am trying to update a UILabel using swift and sockets. I have a Mean stack app working with sockets now. It updates a simple counter when a user presses a button. How could I use sockets and update a UILabel when a user presses a button on the client side of my Mean stack app? Below is the swift code I'm using to update the counter. Any help or suggestions would be greatly appreciated.

import Foundation
import UIKit

class SocketsController: UIViewController, UIAlertViewDelegate {

@IBOutlet weak var socketLabel: UILabel!

@IBAction func buttonOnePressed(sender: UIButton) {
    socket.emit("javascript")
}

@IBAction func buttonTwoPressed(sender: UIButton) {
    socket.emit("swift")

}


let socket = SocketIOClient(socketURL: "192.168.15.92:8000")

override func viewDidLoad() {
    super.viewDidLoad()
    socket.connect()

    socket.on("connect") { data, ack in
        println("iOS::WE ARE USING SOCKETS!")

    }
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

IOS Cross Promotion?

I am a new and ambitious IOS App Developer. I am looking for other ambitious IOS app developers to cross promote with. I have a utilities app coming out soon and would like to cross promote with other IOS developers with utility apps.

I have been searching for quite sometime for people to cross promote with. I would really like to give and receive traffic so we can both benefit.

Thank you!

Quickblox: Messages not saved on quickblox Admin panel

I am using quickBlox in my Application, We have to give sync feature in our application. so we have created a API which will call quickBlox API to get message's of that user, now my problem is that when ever I start new chat (chat with new user) at that time 2-3 messages are stored on Admin Panel, but rest of the message are not getting stored.

I have added save flag to in my code. can you please suggest me what can I do?

QBChatMessage *message = [[QBChatMessage alloc] init];

NSMutableDictionary *paramaterDict = [self prepareDictionaryForMessage:strURL strAttachType:strAttachType];

message.text = [paramaterDict JSONRepresentation];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
params[@"save_to_history"] = @YES;

long timeStamp = [[NSDate date] timeIntervalSince1970];
params[@"date_sent"] = [NSString stringWithFormat:@"%ld",timeStamp];

[message setCustomParameters:params];

IOS & objective C development - how to make the login page appear to the user?

I am in my first days of IOS app development, I am trying to build an authentication system for an already existent iOS App using Objective C.

The app's rootviewcontroller is a tabsview followed by navigationControllers.

What i've done so far:

1- creating the loginviewController class & designing it's UI in the storyboard

2- the same thing for the "registration" & "recover my password" classes

3- linking the root viewcontroller with the login page with a segue of type modal.

4- linking the login page with the registration & recover my password pages with segues of type push.

Now i don't know the steps that i should follow to make the login page appear to the user when he first enters the app & eventually store his state so he can access the app later without having to enter his credentials every time (unless he logs out).

Any help is greatly appreciated, thank you

I am available for any clarifications or eventually some screenshots/source code if needed.

Edit 1 : this is the content of my didFinishLaunchingWithOptions method in my appdelegate.m :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    TabsViewController *controller = (TabsViewController *)self.window.rootViewController;


    controller.managedObjectContext = self.managedObjectContext;
    _observer = [[MyStoreObserver alloc] init];
    [[SKPaymentQueue defaultQueue] addTransactionObserver:_observer];

    //Create sub directories in doesn'n exist
    NSString *documentsDirectory =[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    NSString *pathToFile = [documentsDirectory stringByAppendingString:@"export"];
    BOOL isDir = YES;
    BOOL isFile = [[NSFileManager defaultManager] fileExistsAtPath:pathToFile isDirectory:&isDir];

    if(isFile)
    {
        //it is a file, process it here how ever you like, check isDir to see if its a directory
    }
    else
    {
        [self createSubDirectories];
        //not a file, this is an error, handle it!
    }


    return YES;
}

What should I add/change ??

How to create Date and slot picker in iOS like attached image?

I want to create a date and slot picker in iOS like Meru cab mobile application.

Please check the attached the screenshot for your reference.

Can we create a control like that?

Any help would be appreciated.

http://ift.tt/1EUbQ2E

dimanche 10 mai 2015

Changing array in another class programmatically

I am programmatically presenting a view controller (SavedGames.swift -> OnePlayer.swift), and I cannot figure out how to change the array in the view controller I am presenting (OnePlayer.swift) in the original controller (SavedGames.swift). I want to change tableData in OnePlayer in the block of code in SavedGames.swift.. Hope that makes sense

SavedGames.swift:

        if let resultController = storyboard!.instantiateViewControllerWithIdentifier("OnePlayer") as? OnePlayer {
            presentViewController(resultController, animated: true, completion: nil)

            //in OnePlayer, set tableData to this tableData: [String] = ["one", "two", "three"]
        }

OnePlayer.swift:

var tableData: [String] = ["zero", "zero", "zero"]

ios not get other finger (multitouch) event in UILongPressGestureRecognizer

How can I get multitouch and single touch event?

I try to touch moving (not touch up) left finger, now I click right finger on the screen, But I try to get right finger touch event or touch point.

I set the log [gesture numberOfTouches] or [gesture numberOfTouchesRequired]. I still get 1, not get 2.

In my ViewDidLoad method I set below code:

 - (void)viewDidLoad {
     [super viewDidLoad];
 self.view.multipleTouchEnabled =  YES;
 self.view.exclusiveTouch = NO;

 UILongPressGestureRecognizer *panelLongPressGestureRecognizer =
 [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(panelLongPressRecgonizerAction:)];
 panelLongPressGestureRecognizer.delegate = self;

//panelLongPressGestureRecognizer.numberOfTapsRequired = 1;
//panelLongPressGestureRecognizer.numberOfTouchesRequired = 1;
panelLongPressGestureRecognizer.minimumPressDuration = 0.001;
 [self.view addGestureRecognizer:panelLongPressGestureRecognizer];


 UILongPressGestureRecognizer *panelLongDoublePressGestureRecognizer =
 [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(panelLongPressRecgonizerAction:)];
 panelLongDoublePressGestureRecognizer.delegate = self;
 panelLongDoublePressGestureRecognizer.numberOfTapsRequired = 2;
 panelLongDoublePressGestureRecognizer.numberOfTouchesRequired = 2;
 panelLongDoublePressGestureRecognizer.minimumPressDuration = 0.001;
 [self.view addGestureRecognizer:panelLongDoublePressGestureRecognizer];
 }

 - (void)panelLongPressRecgonizerAction:(UILongPressGestureRecognizer *) gestureRecognizer
 {
 switch (gestureRecognizer.state) {
    case UIGestureRecognizerStateBegan:
        NSLog(@" === long press began ===");
        break;
    case UIGestureRecognizerStatePossible:
        break;
    case UIGestureRecognizerStateChanged:
        NSLog(@" === long press changed ===");
        [self pressChanged:gestureRecognizer];
        break;
    case UIGestureRecognizerStateEnded:
        NSLog(@" === long press end ===");
        break;
    case UIGestureRecognizerStateCancelled:
        NSLog(@" === long press cancell ===");
        break;
    case UIGestureRecognizerStateFailed:
        NSLog(@" === long press failed ===");
        break;


}
NSLog(@" ");

}

- (void) pressChanged:(UILongPressGestureRecognizer *) gesture
{
    NSLog(@"moved guesture.number of touches:%ld", [gesture numberOfTouches]);
    NSLog(@"moved numberOfTouchesRequired of touches:%ld", [gesture numberOfTouchesRequired]);

}

I still get log:

 2015-05-11 14:25:46.117 DroneG2[7521:1149008]  === long press changed ===
 2015-05-11 14:25:46.118 DroneG2[7521:1149008] moved guesture.number of touches:1
 2015-05-11 14:25:46.118 DroneG2[7521:1149008] moved numberOfTouchesRequired of touches:1

Have anyone know where is my question in my code?

I want to get other finger touch point or event when I moving?

thank you very much.

Multiline NSString with a character limit per line

I want to construct a multi line NSString (for printing purpose) with a character limit per line. Each line should have maximum of 25 characters. Number of lines can be anything based on the length of the string. This is my approach which is not the best I guess. Whats is the best way to do this without manually checking the length of the string?

NSMutableString* strCustomerComments = [NSMutableString string];

if([[[arrItems objectAtIndex:0]objectForKey:@"CustomerComment"] length]<=25){
            [strCustomerComments appendString:[NSString stringWithFormat:@"%@",[[arrItems objectAtIndex:0]objectForKey:@"CustomerComment"]]];
}
else{

     [strCustomerComments appendString:[NSString stringWithFormat:@"%@\n%@",[[[arrItems objectAtIndex:0]objectForKey:@"CustomerComment"] substringToIndex:25],[[[arrItems objectAtIndex:0]objectForKey:@"CustomerComment"] substringFromIndex:25]]];
   }  

Objective C-Screenshot doesnot show the image in video

I need to get the screenshot of a video on click of a button.Below is the code used for that,but the image shows only the down part of the video that is the play,next,prev etc..

CGRect rect = [_moviePlayer.view bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[_moviePlayer.view.layer renderInContext:context];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIImageView   *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 100, 100, 100)];
[imgView setImage:image];
imgView.layer.borderWidth = 2.0;
[_firstimage addSubview:imgView];

NSURL *url=[NSURL URLWithString:@"http://ift.tt/1dOzwuu"]; this is the url used .

enter image description here

this is how it shows..How can i get the video image? Can anybody help me..

How to study iOS?

How to develop ios program and Which & What a program is need for developing ios please help me

@interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

Sync iPhone contacts to custom account

I have an iPhone 4. I have set up a custom email account on my phone. It is also set up on my Mac.

When I add contacts to my contacts on my Mac the contacts appear on my iPhone but if I create a contact on my iPhone then the contact doesn't sync back up to my mac.

It looks like the contacts are being added to the phone not to the account on the phone. Is there a way to specify they be added to the custom account rather than the phone?

Authentication not working with google app

I am having some trouble in Authentication while using homeServerClientID and same I am able to reproduce in google sample.

Issue is:

Scenario 1: If i have google app already installed

  • I tapped signin button from my app
  • It open accounts in google app for account selection
  • After authentication it switched back to my app
  • Getting error in finishedWithAuth delegate method (com.google.HTTPStatus error 400)

Scenario 2: Google app not installed

  • I tapped signin button from my app

  • It open accounts in safari

  • After authentication it switched back to my app

  • Worked fine

Glyphicons Icon are loading

Glyphicons are not when page landing first time but after refreshing the page Glyphicons Icon are loading and working fine.

Kindly check the below screenshot. http://ift.tt/1PcVMB9

Programmatically set navigation bar?

I am programmatically presenting a view controller, but when a view controller appears, it is missing a navigation bar. Is there any way to programmatically set a navigation bar on this new view controller when it is called?

Here is my code so far:

    //LOAD CRICKET GAME
    if gameGAMETYPE[index] == "Cricket" && gameGAMEPLAYERS[index] == "1" {

    println("LOAD ONE PLAYER CRICKET")
    //load OnePlayerCricket.swift
    //replace tableData with TABLEDATA

        //programatically present new view controller
        if let resultController = storyboard!.instantiateViewControllerWithIdentifier("OnePlayerCricketVC") as? OnePlayerCricket {
            presentViewController(resultController, animated: true, completion: nil)


        //programmatically present a navigation bar


         NEED HELP HERE!!!! thank you :)


        }

Handing off delegate via Segue - bad pattern?

I have some Obj-c code that is working fine but I'm wondering if it utilizes an 'anti-pattern' and if there is an obvious better route that someone more experienced might take.

  • ViewController1 is acting as the delegate for an object instantiated from a third party library. It is in the foreground.
  • ViewController2 is coming to the foreground. During the segue, in prepareForSegue, ViewController1 sets the delegate of the object that it is currently acting as the delegate for to ViewController2, such that any subsequent delegate calls are received on ViewController2 while it is in the foreground.

This works. And it doesn't bother me too much. But it feels likes something where there might be a more idiomatic solution.

Retrieve users and groups and creating users and group in Ejabber XMPP iOS

I'm using Ejabber XMPP server with a HOST and port. currently i'm developing the app using simulator. I'm able to get list of user(online/offline) but my requirement is to get list of users and groups at once to display in same screen and groups separately again to display in another screen. i'm using coredata stroage. How to store the contacts added/information in server along with local.

For adding a user i'm using the below method. it is not saving in server only locally it is saving.

XMPPJID *newBuddy = [XMPPJID jidWithString:self.buddyField.text];
[self.xmppRoster addBuddy:newBuddy withNickname:@"ciao"];

For creating Group i tried the below link, it says created but i'm not able to see that list of groups i'm not sure that the group is added or not unless i can retrieve the group info.

XMPPFramework - Create an XMPPRoom

Please help me.

*Note: Android app is already developed, in that i have registered with my credentials to test i'm using same credentials in iOS also. If i add a contact Android app i'm able to see in simulator. If i add a contact in iOS app it is showing in my simulator only in Android app it is not updating.

CSS3 responsive issue on iPhone 5, 6

I have designed a website and make it responsive, it's working fine of all browsers and all mobile phones except iPhone 5 & 6...

Images are not showing on the website while all other website is loading.

Please help me on this as I have stuck in this issue, and client is asking again and again.

Here is link to check the website:

http://ift.tt/1AMLjjZ

Code i used for responsive is:

@media all and (max-width: 479px) and (min-width: 250px) { 

.item .item-image
{
    display:block !important;
    z-index:9999 !important;
}
.item .item-image img 
{
    display:block !important;
z-index:9999 !important;

}
#nook .newsfeed li {
    /*display: inline-block;*/
    display:block;
    margin-bottom: 45px;
    margin-right: 13px;
    vertical-align: top;
    width: 100% !important;
}
#month-dropdown {float: left !important;
width: 34% !important;}

.item { overflow:auto !important;}


}

UICollectionView with Images inside UITableView prototype

request for some guidance.

This tutorial helped me realize this must have to do with my DataSource/Delegate. The author builds the cell with addSubview instead of taking advantage of the Xcode prototype cell, which seems like a cool thing, so I'm trying to do it. http://ift.tt/1oUl6vx

Any criticism about my approach or failure to follow best practices is welcome.

Each cell in the table has a UICollectionView. Each cell in the Collection View displays an image in order of the saved "Sequence" string. example: "ADKDQDJDTD" link up to AD.png KD.png QD.png JD.png TD.png

enter image description here

I have two issues I can't seem to get past.

  • numberOfItemsInSection gets whacky when the number of cards is driven by the array length (return handArray.count / 2). If I place a fixed number the app will work, but not very slick.
  • When the table first comes up, the correct cards do not display until I scroll up and down the table. It also appears the data for each CollectionView is crossing paths as the wrong cards show up when scrolling up and down rapidly.

I'm almost positive this has to do with how my datasource is setup.

DeckTableViewController.swift

import UIKit
import Parse

var deviceID: String?
var noRefresh: Bool?
var sequenceArray: Array<Character>?

class DeckTableViewController: UITableViewController, UICollectionViewDelegate, UICollectionViewDataSource {
var handArray: Array<Character>!
var timeLineData:NSMutableArray = NSMutableArray()

override func viewDidLoad() {
    super.viewDidLoad()
    noRefresh = false
    deviceId = UIDevice.currentDevice().identifierForVendor.UUIDString
}

override func viewDidAppear(animated: Bool) {
    if noRefresh == false {
        loadData()
        noRefresh = true
    }
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return timeLineData.count
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    let cell:DeckTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! DeckTableViewCell

    let deck:PFObject = timeLineData.objectAtIndex(indexPath.row) as! PFObject

    cell.collectionView.dataSource = self
    cell.collectionView.delegate = self

    let sequenceTemp = deck.objectForKey("Sequence") as! String
    handArray = Array(sequenceTemp)
    cell.sequenceId.setTitle(deck.objectId, forState: UIControlState.Normal)
    cell.cardCountLabel.text = "\((count(sequenceTemp)/2))"

    // Date to String Stuff
    var dateFormatter = NSDateFormatter()
    dateFormatter.dateFormat = "(MM-dd) hh:mm:ss"
    cell.timeLabel.text = dateFormatter.stringFromDate(deck.updatedAt!)

    let layout:UICollectionViewFlowLayout = UICollectionViewFlowLayout()
    layout.itemSize = CGSizeMake(99, 140)
    layout.scrollDirection = UICollectionViewScrollDirection.Horizontal

    cell.collectionView.collectionViewLayout = layout

    return cell
}


func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return handArray.count / 2
}

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

    let cell:TableCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! TableCollectionViewCell
    var bcolor : UIColor = UIColor.orangeColor()
    cell.layer.borderColor = bcolor.CGColor
    cell.layer.borderWidth = 2
    cell.layer.cornerRadius = 3

    var firstLetter: Character!
    var secondLetter: Character!

    //Building card file names from Sequence data
    if (indexPath.row * 2) + 1 <= handArray.count {

        firstLetter = handArray[indexPath.row * 2]
        secondLetter = handArray[indexPath.row * 2 + 1]
        let imageNameString = "\(firstLetter)\(secondLetter).png"
        let front = UIImage(named: imageNameString)
        cell.ImageView.backgroundColor = UIColor.orangeColor()
        cell.ImageView.image = front

    }

    return cell
}

DeckTableViewCell.swift

import UIKit

class DeckTableViewCell: UITableViewCell, UITextViewDelegate {

    @IBOutlet var collectionView: UICollectionView!
    @IBOutlet var sequenceId: UIButton!
    @IBOutlet var timeLabel: UILabel!
    @IBOutlet var cardCountLabel: UILabel!

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

    }
}

TableCollectionViewCell.swift

import UIKit

class TableCollectionViewCell: UICollectionViewCell {

    @IBOutlet var ImageView: UIImageView!

}

For this example I set (return handArray.count / 2) to a 10 and loaded 3 sequences. The number in the top center represents the number of cards for each row. Notice the CollectionView does not update with the right cards, it's picking up data from the other CollectionViews. IF I add bunch more sequences to this mix, when scrolling up and down, the correct cards WILL populate SOMETIMES, but unpredictable.

enter image description here

Thanks for any suggestions, I'm happy to go back to the drawing board. Cheers

Ejabber XMMP Services for iOS App

I'm developing a chat app using Ejabber XMPP for ios. I'm able to connect and Authenticate to the server. i'm able to see online and offline users also. but i have an issue with the below i search alot but not found solutions for that can someone help me on this things asked below:

  1. How to upload logged-in user avatar as a display pic.
  2. How to a person i'm using below method but it is not adding, i'm using simulator to add the user. if i add in android app it is displaying in my simulator.

    -(void)addUser:(XMPPJID *)jid withNickname:(NSString *)optionalName;

but how to call the above method

  1. How to disable account temporarily
  2. How to delete account
  3. How to share audio/video/photo files in chat
  4. How to create a group

How to change backgorund color of UINavigationItem?

I have a UINavigationItem, but I cam't found anything beside tittle, prompt, and back button in attribute inspector

attribute inspector

I wonder how can I change my UINavigationItem background color using code? or programmatically?

Video download in iPhone using jsp

I implemented video download using jsp.

It works fine in PC browsers and ANDROID.

It doesn't in 'iPhone'

Any one who knows why?? I'm still searching. Thanks.

<%@ page contentType="application/octet-stream;charset=utf-8" %>

<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>

<%
    out.clear();            // getOutputStream() has already been called for this response 예외를 처리하기 위한 구문
    pageContext.pushBody(); // getOutputStream() has already been called for     this response 예외를 처리하기 위한 구문

    InputStream     is  = null;
    OutputStream    os  = null;

    File            file    = new File( "/home/does/song", "Sc02.mp4" );        // 파일 불러올 때는 확장자도 일치해야 함. 혹은 소문자로.

    try {
        is = new FileInputStream( file );
    } catch( Exception e ) {
        out.print( e.getMessage() );
    }

    response.setContentType( "video/mp4" );
    response.setHeader("Content-Disposition", "attachment;filename=movie.MP4");
    response.setContentLength( (int)file.length() );
    response.setHeader("Pragma", "no-cache");


    os = response.getOutputStream();
    byte [] b = new byte[ (int)file.length() ];
    int leng = 0;

    while( ( leng = is.read(b)) > 0 )
        os.write( b, 0, leng );

    is.close();
    os.close();
%>

Admob ads not appear in footer of UITableView when keyboard is shown

I use this to show Admob ads on the footer of UITableView:

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    GADBannerView *sampleView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        sampleView.hidden=true;
    }

    sampleView.adUnitID = @"myID";

    sampleView.rootViewController = self;

    [sampleView loadRequest:[GADRequest request]];
    return sampleView;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 50.0;
}

I do not have real iPhone device, so I only test it on simulators. The above code works if the software keyboard is hidden and I typed the word using my MacBook keyboard. However, when I open the software keyboard in simulator, the ads failed to load at footer. Instead it loads directed below the searching bar. How should I solve this? I don't know if this bug also occurred in the real device.

Admob no in footer

Xamarin Ios screen reload issue

I have recently created a ios application using Xamarin. The aplication is writen is C#. The application is a little complex and big. It has a lot of dynamic menus. I have noticed a problem that I could not solve it. When I want to remove a sub view and add another subview sometimes, especially it the system is high loaded the first subviews is not removed but the second is add and they overlap.

I have tried a lot of things to remove the sub view from view:

sub.RemoveFromSuperview();

InvokeOnMainThread ( () => {
sub.RemoveFromSuperview();
}); 

or

view.WillRemoveSubView(sub);
sub.RemoveFromSuperview();

but still sometimes work and sometimes it does not work. Is there any problem, with my approach or there is some problems with IOS. Is there any way to fix this. This problem appears in iPhone and iPad too.

Thanks in advance

Debug on Apple Watch: Error Launching 'xxx WatchKit Extension' - Couldn’t communicate with a helper application

I am trying to debug on my apple watch (real device, not simulator). My main project runs on my iPhone fine, and the corresponding watch app shows up on my watch. I want to attach the debugger to my watch app, so in Xcode I choose WatchKit App scheme, then choose my iPhone. I hit the run button, and an error window pops up, with title Error Launching 'xxx WatchKit Extension' and description Couldn’t communicate with a helper application.

Both my main app and watch app run fine if I build and run by choosing the main app scheme, however I wish to attach the debugger to my watch app scheme. Does anyone know what might be causing this error? Thanks in advance.

jQuery Mobile App - Fusion Tables Map click-to-call in infowindow isn't executing

Image Link of Issue - http://ift.tt/1IuWCDQ

When I open the fusion map within the safari browser on my phone and click on the number it gives me the option of calling that number, when I run it through the app however it does not.

I have put the following code in the fusion table

<a href="callto:12345678">+1 (555) 555-5555</a>

The 'tel:' function does not work either.

Thanks in advance for any help.

buliding an iOS app About Sports SDK and API?

The Problem is that i am developing iOS Application which can synchronize all the live sports event around the globe like football , and other etc. Now I have been researching about this and get to know something about Sports SDK and API now Anyone please tell me what is it ? and also tell me something that what are fantasy sports are they like fake sports for games applications.

rotating radar on Map Overlay in Map overlays

In my App there is a rotating Radar display over the user's current location. I have created a circular overlay on the Map over current location with a gray colour but I need to make the overlay in such a way like it is rotating over the map like a clock and fill it with the gray colour. I have tried a lot but could not get the proper solution over the Map overlay. Anyone have any idea how to get this done?

How to youtube videos to custom uitableviewcell

i'm new to iOS development. i would like to display few webpages using uiwebview and a label which are on a custom table cell i've succeeded in getting different names for different cell but getting same url in each custom cell. how can i get different URLs for different cell ![enter image description here][1]

How do I adding to score a collision? I'm beginner Thanks

How do I adding to score a collision? I'm beginner Thanks

Here is my code:

func didBeginContact(contact: SKPhysicsContact) {

    var firstBody: SKPhysicsBody
    var secondBody: SKPhysicsBody

       func addScore() {
        score = +1

    }

    if contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask {
        firstBody = contact.bodyA
        secondBody = contact.bodyB

    } else {
        firstBody = contact.bodyB
        secondBody = contact.bodyA

    }

    if ((firstBody.categoryBitMask & PhysicsCategory.monster != 0) &&
        (secondBody.categoryBitMask & PhysicsCategory.naboj != 0)) {

            if let firstNode = firstBody.node as? SKSpriteNode,
                let secondNode = secondBody.node as? SKSpriteNode  {

                    projectileDidCollideWithMonster(firstNode, monster: secondNode)
}

}

}

}

UITextField within UIScrollView Constraint Resize

I am having issues with Constraints and setting up a simple UITextField within a UIScrollView. I have set the constraint to the left and right of the UITextField so that it should autoresize if I rotate from Portrait to Landscape. However if you embed this same constraint within a UIScrollView, the UIScrollView doesn't resize the UITextField but instead it gives you a horizontal scroll bar and the UITextField uses the default width. How can you not use width or minimum width?

How can I auto-resize the UITextField within a UIScrollView using the constraints? I'm just trying to setup a simple form within a UIScrollView but the sizing is not working.

UITexttField within UIScrollView

Xcode 5.1 crashing when i try to open .xib file

I am using xcode 6.1.I have created App using Autolayout.I wanted to test the app on ios6 so i Download the xcode 5.0 when i try to open .xib File xcode is crashing.

Swift read data from file as its being written to live

I would like to read this video stream live and convert it to NSData. I am struggling with being able to read the stream live right now. I can only access it after the recording is finished. I found this old post but I do not understand it.

var outputFilePath: String = NSTemporaryDirectory().stringByAppendingPathComponent( "movie".stringByAppendingPathExtension("mov")!)


self.movieFileOutput!.startRecordingToOutputFileURL(NSURL.fileURLWithPath(outputFilePath), recordingDelegate: self)

Can we measure the data of M7/M8 while the iPhone is unawakened in the CLVisit delegate method?

Can I write the code in this method to get the M7's data and does it useful while I don't run the app?

-(void)locationManager:(CLLocationManager *)manager didVisit:(CLVisit*)visit
{

}

Adding to a NSCompoundPredicate

I want to make my code more reusable for core data, I have a fetchRequest with predicates that I always must use. However some methods require more conditions. I want to add those conditions to the predicate list however I am unsure how to do this. I would like a method to return a predicate with basic queries and then add on to those queries.

 let fetchRequest = NSFetchRequest(entityName: "Stop")

        var currentTime = NSDate.getTime()

        var sort = NSSortDescriptor(key: "time", ascending: true) // sort by bus stop

        fetchRequest.sortDescriptors = [sort]

        let predicate = NSPredicate(format: "time >= %ld", currentTime)

        let predicate2 = NSPredicate(format: "stop_name == %@", stop)

        let predicate3 = NSPredicate(format: "busParent.direction == %@", direction)

        let predicate4 = NSPredicate(format: "busParent.name == %@", name)

        let predicate5 = NSPredicate(format: "busParent.schedule == %ld", schedule)

        fetchRequest.predicate = NSCompoundPredicate.andPredicateWithSubpredicates(
            [predicate, predicate2, predicate3, predicate4, predicate5])

        // EXAMPLE:  HOW WOULD I ADD TO THE COMPOUND PREDICATE ALREADY MADE?
        fetchRequest.predicate.????

Android material animations in ios cocoa touch

Apologies for the generic question however I am in need of some guidance so that I can do further reading.

The question is:

Is it possible to do UI transitions similar to android material UI transitions in IOS Cocoa touch? Can core graphic or core animation do complex shape tweening like flash (not just animating simple properties such as opacity or size.

For example please have a look at the following link: http://ift.tt/1EtHReD

How can such animation effects be accomplished in cocoa touch?

Any pointers would be useful so that I can do further reading.

Many thanks

Can Anyone tell me how to parse JSON object with different key IOS ?

Here's the Part of Json object---

  • comm_commentaries: {

    • comment: {

      • 1: {
        important: "False",
        isgoal: "False",
        minute: "90'",
        comment: "Attempt missed. Eliaquim Mangala (Manchester City) header from the centre of the box misses to the left. Assisted by Jesús Navas with a cross following a corner.",
        id: "8429441"
        },
      • 2: {
        important: "False",
        isgoal: "False",
        minute: "90'",
        comment: "Corner, Manchester City. Conceded by Shaun Wright-Phillips.",
        id: "8429402"
        },
      • 3: {
        important: "False",
        isgoal: "False",
        minute: "90'",
        comment: "Attempt blocked. Wilfried Bony (Manchester City) right footed shot from the centre of the box is blocked. Assisted by Yaya Touré.",
        id: "8429401"
        },
      • 4: {
        important: "True",
        isgoal: "True",
        minute: "87'",
        comment: "Goal! Manchester City 6, Queens Park Rangers 0. David Silva (Manchester City) right footed shot from very close range to the bottom right corner. Assisted by Wilfried Bony with a through ball.",
        id: "8429400"
        },

      }
      }

how to programatically zoom in/out mkmap

Hmm, I know this is a simple question but I am new in using MKMaps in iOS. My app is not behaving the same per launch. I have a map and the title of the page will depend on the number of 'job pins' visible in the map. When I am running the app in xcode it displays the correct number, but when I am running the app by itself it does otherwise (but when i moved the map it changes to the correct number of pins visible in the map). The solution I was thinking of is to programmatically zoom in/out the map - on load. Is there a way to do this? I'm really stuck right now.

Thanks in advance!

how can I offline distribute ios app

Is there anyway that I can distribute my IOS application offline? I need to put my ipa file on a local network and allow my internal customers download and install them.

I was read about Apple Enterprise program but is it completely offline? and i heard it need us to submit all devices to apple!

is there any other way to install ios app completely offline on public devices?

Best Regards

dynamically change uitableviewcell or uitableview in ios objectivec

I am working on a project where i need to show the users activity. The activity will have images and texts

user can write a comment on the activity.

I am trying to implement this on uitableview. As i am not sure where to study the uitableview as online tuts will only give the basic usages.

If anyone can suggest how to implement this(doesn't necessarily using tableview as so far i can think of tableview only) will be great help.

So if I am implementing this using tableview i need to change the cell dynamically. for a simple experiment i tried

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:1] ;
UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:indexPath];
UIView * commentView = [[UIView alloc] initWithFrame:CGRectMake(0,0,cell.frame.size.width,cell.frame.size.height)];
[commentView setBackgroundColor:[UIColor blueColor]];
[cell addSubview:commentView];

but nothing is changing.

Why are there trailing slashes in NSURL constructed from initWithScheme ...?

When using the NSURL constructor

initWithScheme:(NSString *) host:(NSString *) path:(NSString *)

iOS for some reason appends two extra trailing slashes if the path ends with a slash, unless it's only @"/".

enter image description here

Does anyone know why this is, and if there's a way around it other than composing the url manually with something like

[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@%@", scheme, host, path]];

Using Audio Effects with iPhone music library

I'm trying to add some audio effects to an iPhone app I'm developing.

The app is a music player that allows users to choose songs from their iTunes music library. I want them to be able to carry some basic adjustments for example Bass, Middle, Treble and perhaps add some reverb. I've played around with NVDSP and looked at audio units however these don't seem to work with the iTunes library due to DRM restrictions.

Has anybody managed to achieve this? Thanks in Advance.

iOS AutoLayouts, wrong UIView frame

I have an xib file and I want my green UIView to change its height according to Device, but whenever I want to get it height with methods

[self.tablePlaceView frame]; [self.tablePlaceView bounds];

it returns {{0, 0}, {320, 568}} on all Devices, but on previews and device it does everything right.

http://ift.tt/1AONzav

Passing Data from TableView to ViewController

I'm trying to send data from a table view to a viewController but it keeps crashing. Here is what i have done:

in prepare for segue

if ([segue.identifier isEqualToString:@"detailSegue"]){
    DetailView *dv = [segue destinationViewController];
    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
    dv.stringForFirstLabel = [_cell.firstArray objectAtIndex:indexPath.row]
 }

but it logs this

: unrecognized selector sent to instance.

IPhone/iPad: App Crash when Images Display on CollectionView while images are fetching from url

UICollectionView received memory warning when images are load & i'am using SDwebimages for fetching images.

My code :

 (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
    Drinks *drink = [self.allDrinks objectAtIndex:indexPath.item];
    NSString *drinkImage;  
    drinkImage = [NSString stringWithFormat:@"http://ift.tt/1bHFmy4",drink.drinkid];}

    UIImageView *imageView    = (UIImageView *)[cell viewWithTag:2];

    [imageView setImageWithURL:[NSURL URLWithString:drinkImage] placeholderImage:[UIImage imageNamed:@"logo_black"]];

    [cell.contentView addSubview:imageView];
 }

App crash & received low memory warning.

i read UICollectionView received memory warning while scrolling.

Weird iOS Keychain access group behaviour

Recently we added Apple Pay support to our project and it caused some problems accessing data stored in iOS KeyChain. Basically we couldn't access "old" data that was stored before adding the entitlements file. In the entitlement file we only got the com.apple.developer.in-app-payments value (we don't used shared keychain groups).

I manually dumped the keychain data from the simulator and noticed that the "old" data access group (agrp) is set to test and the new data (I wrote a value to the same "default" keystore to understand the difference) agrp is set to the bundle identifier.

Anyone knows what's the "test" agrp and why the old data gets that access group? More importantly - is there any way to access that old data again?

I have mac osx and cant debug my cordova app remotely?

I have an ipa which is installed on my iphone 5 from phonegap build (debug enabled app).

I want to inspect element and see console logs via my mac, meaning, i want the app to work on my phone, and i want to do and see stuff (html and javascript wise) in my mac.

I have the "develop" menu enabled in my osx, i plug my iphone to the mac, i open the phonegap app, then im suppose to see the app in the menu options under the iphone tab, but i can't see nothing! (nothing is not the right word, i do see webpages that are open in my iphone, but not my phonegap stuff)

What is the way to web inspect the ios phonegap app?

verifying receipts against the sandbox URL in a production app?

by mistake I forget to change the sandbox validation url to the production one and unfortunately the app is live now? my question is what will happen if someone purchase from the app! is the purchase will success or fail??

Please advice ASAP.

[IOS]How to dynamic delete view from tableviewcell using autolayout

I'm a objective-c beginner.I want to achieve a demo likes twitter.Now I'm trying to dynamic delete a subview from tableviewcell,and I using autolayout.As we know some twitters include image(or forwarding content) and some have not.So I use tableview.cell.hidden=YES to hidden a cell who does not include forwarding content,like this:

    if(retweetedStatus.text != nil) {
        User *retweetedUser = [retweetedStatus user];
        NSString *strRetweetedStatus = [[NSString alloc]initWithFormat:@"@%@:%@",retweetedUser.screenName, retweetedStatus.text];
        cell.retweetedStatusLabel.text = strRetweetedStatus;
        cell.retweetedStatusLabel.hidden = NO;    
    } else {
        cell.retweetedStatusLabel.hidden = YES;
    }

So my issue is when a subview of cell has set hidden and it is still occupied space.In addition,my dynamic tableview reference this blog: http://ift.tt/1LLxdHj Who can tell me how to fix this issue,thanks!

PFUser currentUser not saving in iOS7

I am using the below code to save the currently logged in user with custom field. I allow the user to fill in information and then save. I used both the save methods on my own threading using GCM and used the saveInBackgrounWithBlock. On iOS8, this works ok but on iOS7 saving never happens and the completion block is never called. Any ideas? Thanks

       if PFUser.currentUser() != nil {
            PFUser.currentUser().setObject(installation, forKey: "installation")
            PFUser.currentUser().saveInBackgroundWithBlock({ (bool: Bool, error: NSError?) -> Void in
                if(error != nil) {
                    let alert = UIAlertView(title: "Problem Saving", message: "Make sure you are connecte to the internet and try again", delegate: nil, cancelButtonTitle: "OK")
                    alert.show();
                }
            })
        }

samedi 9 mai 2015

How to get properties(title,description etc) of a NSURl without using UIWebView?

Is it possible to get the description, thumbnail and tittle of a NSURL link without UIWebView?

How to open an image or any document in default IPhone software(photo editor or pdf viewer) by its URL stored in application?

I have stored an image url in my app from photos library and want to open it in IOS default image open Application(Photo Editor) by tapping on Open button in my application.

i'm unable to find the solution.

How to upgrade iphone to NON-latest ios?

We have (not jailbroken) iphone 4s (Model:A1387), currently running ios 5.1. We want to upgrade it to ios 6.0. However, from the phone or from itunes, it allows us to upgrade only to the latest version of ios, which is ios 8.3. Our requirement is to upgrade specifically to ios 6, since we have different devices for testing on different OS.

Is there a supported path to upgrade from ios 5.1 to ios 6 for iphone 4s?

Check location is in a pre-defined area (Swift)

I am currently building an iOS app and would like to use the device's location data to determine what train station they are currently in. How can this be done using swift?

how to update UILabel using sockets

I am trying to update a UILabel using swift and sockets. I have a Mean stack app working with sockets now. It updates a simple counter when a user presses a button. How could I use sockets and update a UILabel when a user presses a button on the client side of my Mean stack app? Below is the swift code I'm using to update the counter. Any help or suggestions would be greatly appreciated.

import Foundation
import UIKit

class SocketsController: UIViewController, UIAlertViewDelegate {

@IBOutlet weak var socketLabel: UILabel!

@IBAction func buttonOnePressed(sender: UIButton) {
    socket.emit("javascript")
}

@IBAction func buttonTwoPressed(sender: UIButton) {
    socket.emit("swift")

}


let socket = SocketIOClient(socketURL: "192.168.15.92:8000")

override func viewDidLoad() {
    super.viewDidLoad()
    socket.connect()

    socket.on("connect") { data, ack in
        println("iOS::WE ARE USING SOCKETS!")

    }
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

What software limitations are there to upgrading iphone storage?

I have an 8Gb iphone. i have a board for my old 64gb ipod. And I was thinking that I should swap the storage chips if they are compatible. but then I thought, this is apple we're dealing with. life can't be simple if its free. So what software limitations are there? Will it somehow recognize theres more storage and use it?

Also is the bios stored on the same chip as the storage one?

Show Game Centre Leaderboard not working in swift

I am coding in swift and I am getting the following error message from my submit button. The leaderboard does not show up in the simulator, just gives me the error message below

<GKGameCenterViewController: 0x7a8d0800> on     <Chinese_Quiz.OpeningViewController: 0x78688aa0> whose view is not in the  window hierarchy!

Below is all the game centre code from my app.

  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    Randomize()
    Hide()
    authenticateLocalPlayer()

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
@IBAction func Submit(sender: AnyObject) {
    saveHighscore(Score)
    showLeaderboard()

}

func authenticateLocalPlayer(){

    var localPlayer = GKLocalPlayer.localPlayer()

    localPlayer.authenticateHandler = {(viewController, error) -> Void in

        if (viewController != nil) {
            self.presentViewController(viewController, animated: true, completion: nil)
        }

        else {
            println((GKLocalPlayer.localPlayer().authenticated))
        }
    }

}

func gameCenterViewControllerDidFinish(gameCenterViewController: GKGameCenterViewController!)
{
    gameCenterViewController.dismissViewControllerAnimated(true, completion: nil)

}

func showLeaderboard() {
    var vc = self.view?.window?.rootViewController
    var gc = GKGameCenterViewController()
    gc.gameCenterDelegate = self
    vc?.presentViewController(gc, animated: true, completion: nil)
}



    func saveHighscore(score:Int) {

    //check if user is signed in
    if GKLocalPlayer.localPlayer().authenticated {

        var scoreReporter = GKScore(leaderboardIdentifier: "ChineseWeather") //leaderboard id here

        scoreReporter.value = Int64(Score) //score variable here (same as above)

        var scoreArray: [GKScore] = [scoreReporter]

        GKScore.reportScores(scoreArray, withCompletionHandler: {(error : NSError!) -> Void in
            if error != nil {
                println("error")
            }
        })

    }

}

how can we implement slider to forward song in iphone lock screen

Like default music app can we implment fuctionality to drag slider to forward backward song. This is useful if son is long and u want a quick view.

Mac Chat App, Not getting NSInputStream & NSOutputStream

I am working with a chat application with a simple python localhost server, using NSStream to send and recieve data via network socket connection. App just worked fine in the iPhone application, but not getting stream in the mac application.

My Python Server Code

from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor

class MacChat(Protocol):
  def connectionMade(self):
    print "a client connected"
    self.factory.clients.append(self)
    print "clients are ", self.factory.clients
  def connectionLost(self, reason):
    self.factory.clients.remove(self)
  def dataReceived(self, data):
    a = data.split(':')
    print a
    if len(a) > 1:
        command = a[0]
        content = a[1]

        msg = ""
        if command == "iam":
            self.name = content
            msg = self.name + " has joined"

        elif command == "msg":
            msg = self.name + ": " + content
            print msg

        for c in self.factory.clients:
            c.message(msg)
  def message(self, message):
    self.transport.write(message + '\n')

factory = Factory()
factory.clients = []
factory.protocol = MacChat
reactor.listenTCP(80, factory)
print "Mac Chat server started"
reactor.run()

Mac

ChatViewController.h

#import <Cocoa/Cocoa.h>
@interface ChatViewController : NSViewController
@property (strong,nonatomic) NSString *userName;
@end

ChatViewController.m

#import "ChatViewController.h"


@interface ChatViewController ()<NSTableViewDataSource,NSTableViewDelegate,NSStreamDelegate>
{
  NSInputStream *inputStream;
  NSOutputStream *outputStream;
  NSMutableArray * messages;
}
@property (weak) IBOutlet NSButton *btnSend;
@property (weak) IBOutlet NSTextField *txtMessage;
@property (weak) IBOutlet NSTableView *tableview;
@end

@implementation ChatViewController

- (void)viewDidLoad {
  [super viewDidLoad];

// Do view setup here.
}
-(void)setUserName:(NSString *)userName
{
  [self initNetworkCommunication];
  NSString *response  = [NSString stringWithFormat:@"iam:%@",userName];
  NSData *data = [[NSData alloc] initWithData:[response dataUsingEncoding:NSASCIIStringEncoding]];
  [outputStream write:[data bytes] maxLength:[data length]];
  messages = [[NSMutableArray alloc] init];
}

- (void)initNetworkCommunication {
  CFReadStreamRef readStream;
  CFWriteStreamRef writeStream;
  CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"localhost", 80, &readStream, &writeStream);
  inputStream = (__bridge_transfer NSInputStream *)readStream;
  outputStream = (__bridge NSOutputStream *)writeStream;
  inputStream.delegate=self;
  outputStream.delegate=self;
  [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
  [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
  [inputStream open];
  [outputStream open];
}
- (IBAction)btnAtnSend:(id)sender {
  NSString *response  = [NSString stringWithFormat:@"msg:%@",   self.txtMessage.stringValue];
  NSData *data = [[NSData alloc] initWithData:[response dataUsingEncoding:NSASCIIStringEncoding]];
  [outputStream write:[data bytes] maxLength:[data length]];
  self.txtMessage.stringValue = @"";
}
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {

// Get a new ViewCell
  NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];

// Since this is a single-column table view, this would not be necessary.
// But it's a good practice to do it in order by remember it when a table is multicolumn.
  if( [tableColumn.identifier isEqualToString:@"cell"] )
  {
    NSString *s = (NSString *) [messages objectAtIndex:row];
    cellView.textField.stringValue = s;
  }
  return cellView;
}


- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
  return [messages count];
}
-(CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
{
  return 30;
}
#pragma mark NSStream Delegate

-(void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode
{
  switch (eventCode) {

    case NSStreamEventOpenCompleted:
        NSLog(@"Stream opened");
        break;

    case NSStreamEventHasBytesAvailable:
        if (aStream == inputStream) {

            uint8_t buffer[1024];
            int len;

            while ([inputStream hasBytesAvailable]) {
                len = (int)[inputStream read:buffer maxLength:sizeof(buffer)];
                if (len > 0) {

                    NSString *output = [[NSString alloc] initWithBytes:buffer length:len encoding:NSASCIIStringEncoding];

                    if (nil != output) {
                        NSLog(@"server said: %@", output);
                        [self messageReceived:output];

                    }
                }
            }
        }
        break;

    case NSStreamEventErrorOccurred:
        NSLog(@"Can not connect to the host!");
        break;

    case NSStreamEventEndEncountered:
    {
        [aStream close];
        [aStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    }
        break;

    default:
        NSLog(@"Unknown event");
  }
}
- (void) messageReceived:(NSString *)message {
  [messages addObject:message];
  [self.tableview reloadData];
  [self.tableview scrollRowToVisible:messages.count-1];
}
@end

How to Make my Cydia Tweak Work on iPhone 6?

I have a tweak on cydia called Don't Kill the Beat. It forces apps to allow music.app to play audio instead of automatically pausing. It works on iPhone 5S and below, but not the iPhone 6. I find it hard to believe because the 5S and 6/6+ have the same architecture (arm64). Here is my code:

    #import <SBApplication.h>

%hook SBApplication

- (bool)supportsAudioBackgroundMode { return TRUE; }

%end

And here is my makefile:

export ARCHS = armv7 armv7s arm64
export TARGET = iphone:clang
export SDKVERSION = 7.0
export SDKVERSION = 8.1
include theos/makefiles/common.mk
TWEAK_NAME = DontKillTheBeat
DontKillTheBeat_FILES = Tweak.xm
subprojects=dontkillthebeat

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
    install.exec "killall -9 SpringBoard"
include $(THEOS_MAKE_PATH)/aggregate.mk

How can I get it to work on iPhone 6/6+? I appreciate all ideas.

iOS frequency of taking photos vs video

I am a beginner iOS developer working as a developer on a research project. We want to be able to take several photos within a couple seconds, but also want full control on adjusting the frequency of photos taken per second.

What are the limitations put in place of the number of photos the iPhone can take per second via the regular camera (not burst or tkmelapse)? Is there a maximum value?

Or is there a way to control the frequency of capturing in video?

Status bar's style issue

I need a "Light content" status bar for my iOS 8 app but it will show up as Dark. This thing persits and I can't get it work.

Some things I have tried

  • Setting the Status bar style in the Info.plist
  • Setting the style through code with UIApplication
  • Trying to set the UINavigationBar
  • Setting the Status bar property for UIViewControllers

None of the above works, I get a "Light content" on the Loading Screen storyboard but it gets dark as soon as it loads the starting UIViewController from the storyboard. Any thoughts why this is happening? Thank you.

How can I detect an error when searching through a property list?

Okay, here's the gist of my app:

On the first screen, you enter a 4 digit code. When you press done, it saves the code automatically switches views to the next screen. On the new screen, it pulls up the saved code and searches through a plist trying to find the string it's associated with. It currently works perfectly except for when the user enters a code that is not in the plist.

How can I teach it to give an error alert of the code is not present in the plist?

Thanks in advance!

I can't figure out why viewport isn't working how it should be?

I'm creating a small portal for my company using JotForm but i can't get the page to be fully zoomed out on an iPhone. I've embedded the form within a page on a test site.

I've used the viewport feature (the page is responsive by default with jotform) but it just won't zoom out fully on loading the page on an iPhone.

The page is --> http://ift.tt/1dU1KGp

In all honesty, im not trained in html/css, im just learning as i go along at the moment but just can't figure this one out.

It may just be really obvious and that i need a second opinion.

Thanks in advance!

App must also run on iPad without modification

2.10-iPhone Apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resoluution

I saw all other same questions about this problem that had been asked here in stack-overflow, but It can't be fixed , I don't know what the problem is because my app is only for iPhone and not universal, I tried almost all instructions and answers that I found here in stack overflow but problem is same... here is a screenshot from apple when app is running on iPad:

http://ift.tt/1DXDWWR

Can not change to another view controller with multiple segue. How can i resolve it?

I'm using multiple segue in swift and i have an alertbox in a tableview. The alertbox shows perfectly. When i click to the first Option (Ver Mapa), it changes perfeclty to another viewController(Mapa) with segue("go_to_mapa"). But when i press the second Option (Ver detalle) with segue ("go_to_detalle") to change to the anotherviewcontroller, it doesn't work. Does not do nothing. How can i resolve it please?

override func prepareForSegue(segue: (UIStoryboardSegue!), sender: AnyObject!) {

    var refreshAlert = UIAlertController(title: "Menu", message: "Seleccione una opcion", preferredStyle: UIAlertControllerStyle.Alert)

    refreshAlert.addAction(UIAlertAction(title: "Ver Mapa", style: .Default, handler: { (action: UIAlertAction!) in
        if (segue.identifier == "go_to_mapa") {
            var svc = segue!.destinationViewController as Mapa;

            svc.cuenta = self.cuenta
            svc.user = self.user
            svc.password = self.password

            let indexPath = self.tableView.indexPathForSelectedRow();
            let currentCell = self.tableView.cellForRowAtIndexPath(indexPath!) as UITableViewCell!;

            svc.Device = currentCell.detailTextLabel!.text!
            svc.desc = currentCell.textLabel!.text!

            self.navigationController?.pushViewController(svc, animated: false)

        }



    }))
    refreshAlert.addAction(UIAlertAction(title: "Ver Vehiculo", style: .Default, handler: { (action: UIAlertAction!) in

       if (segue.identifier == "go_to_detalle") {
            let vc = segue.destinationViewController as Detalle_Vehiculo

        }


    }))
    refreshAlert.addAction(UIAlertAction(title: "Ejecutar comandos", style: .Default, handler: { (action: UIAlertAction!) in
        println("Ejecutar comandos")
    }))

    presentViewController(refreshAlert, animated: true, completion: nil)

}

UISplitViewController - dismiss / pop Detail View Controller in code in collapsed mode

Since iOS8 we're allowed to use UISplitViewController on both compact and regular devices. This is great because I don't have to create two different storyboard for iPhone and iPad, but there's one problem that I'm stuck with.

If the split view controller is on iPad(if the collapsed property is NO), I can simply call this to show MasterVC on the left side.

self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryOverlay;
[self.splitViewController.displayModeButtonItem action];

But if it's on iPhone(if the collapsed property is YES), the displayMode is ignored, and doesn't do anything.

I cannot pop DetailVC with popToRootViewControllerAnimated because DetailVC has it's own navigation controller.

How does Apple expect us to show MasterVC(dismiss DetailVC) in code in collapsed mode if there isn't any method like dismissViewControllerAnimated:completion: for view controller that was presented with showDetail? Your help will be appreciated. Thanks

String is nil with Parse.com in Swift 1.2

I've searched on many question but I haven't found my answer... Before my code was working pretty well, but it was before Swift 1.2... Could you help me to know why : Could not find an overload for '!=' that accepts the supplied arguments

    var user = PFUser.currentUser()
    UserName.text = user!.username
    UserEmail.text = user!.email
    if (user["phone"] != nil)
    {
        UserPhone.text = user["phone"] as! NSString as String
    }
    else
    {
        UserPhone.text = "Unknow"
    }

CSS3 RESPONSIVE ISSUE IN IPHONE 5,6

I have designed a website and make it responsive, it's working fine of all browsers and all mobile phones except Iphone 5 & 6...

Images are not showing on the website while all other website is loading...

Please help em on this as i have stuck in this issue, and client is asking again and again..

Here is link to check the website:

http://ift.tt/1AMLjjZ

Code i used for responsive is

@media all and (max-width: 479px) and (min-width: 250px) { 

.item .item-image
{
    display:block !important;
    z-index:9999 !important;
}
.item .item-image img 
{
    display:block !important;
z-index:9999 !important;

}
#nook .newsfeed li {
    /*display: inline-block;*/
    display:block;
    margin-bottom: 45px;
    margin-right: 13px;
    vertical-align: top;
    width: 100% !important;
}
#month-dropdown {float: left !important;
width: 34% !important;}

.item { overflow:auto !important;}


}

UIImage Animation in both direction

UIImage Animation which animates like pendulum in both directions like starting point to left then back to starting point and then go to right

How to work with get and post methods in ios

I'm not able handle with get and post methods in web services please help me sort out this example: i have three buttons in my view controller if button on and off i need cal web services .

iOS 7 App Loading View Flash before appear

I am building an App and Deployment Target back to iOS 7 (so Launch Screen File in xCode6 not work for me)

The issue is App will have launch images which appear at the beginning. After AppDelegate Finished and loading a NavigationView as rootViewController (defined in Storyboard). I added a new subview (in ViewDidLoad) with same Launch Image with UIActivityIndicatorView (so it keep smooth and telling user it is working).

The problem is after AppDelegate finished, it will show the View of RootViewController and then show 'Launch image with UIActivityIndicatorView'. Although it show very fast, it look like the screen flash and it affecting user experience.

What should I do to avoid it? Thank you

- (void)viewDidLoad
{
    [super viewDidLoad];

    //Create a simple UIView with BG img and UIActivityIndicator
    dispatch_sync(dispatch_get_main_queue(),^{
        [self popLoadingScreenWithType:0];
    });

    //...something else for App execute
}

Don't Move Table View Cells with a Long Press Gesture

I've completely implemented the UILongGesture in my App which exchanges the cell value by drag and drop. For now I've requirement that if I move first row with last row then first row should remain at first position means don't want change the position. I've tried chunk of codes and wasted my time but couldn't get result. Can anyone help me and yeah i'm new to developing iOS so please don't downvote me :) Thanks in advance help is highly appreciated. Below is my code.

- (IBAction)longPressGestureRecognized:(id)sender{

UILongPressGestureRecognizer *longGesture = (UILongPressGestureRecognizer *)sender;
UIGestureRecognizerState state = longGesture.state;
CGPoint location = [longGesture locationInView:self.tblTableView];
NSIndexPath *indexpath = [self.tblTableView indexPathForRowAtPoint:location];

static UIView *snapshotView = nil;
static NSIndexPath *sourceIndexPath = nil;

switch (state) {
    case UIGestureRecognizerStateBegan:
        if (indexpath) {
            sourceIndexPath = indexpath;
            UITableViewCell *cell = [self.tblTableView cellForRowAtIndexPath:indexpath];
            snapshotView = [self customSnapshotFromView:cell];
            __block CGPoint center = cell.center;
            snapshotView.center = center;
            snapshotView.alpha = 0.0;
            [self.tblTableView addSubview:snapshotView];
            [UIView animateWithDuration:0.25 animations:^{

                center.y = location.y;
                snapshotView.center = center;
                snapshotView.transform = CGAffineTransformMakeScale(1.05, 1.05);
                snapshotView.alpha = 0.98;

                cell.alpha = 0.0;

            } completion:^(BOOL finished) {
                cell.hidden = YES;
            }];
        }
        break;

    case UIGestureRecognizerStateChanged: {
        CGPoint center = snapshotView.center;
        center.y = location.y;
        snapshotView.center = center;

        if (indexpath && ![NSIndexPath isEqual:sourceIndexPath]) {

    [self.namesArray exchangeObjectAtIndex:indexpath.row withObjectAtIndex:sourceIndexPath.row];

            [self.tblTableView moveRowAtIndexPath:sourceIndexPath toIndexPath:indexpath];

            sourceIndexPath = indexpath;

            NSIndexPath *indexPathOfLastItem =[NSIndexPath indexPathForRow:([self.namesArray count] - 1) inSection:0];
            NSLog(@"last :::: %@",indexPathOfLastItem);

            if (indexpath==indexPathOfLastItem) {
                [self.namesArray exchangeObjectAtIndex:indexPathOfLastItem.row withObjectAtIndex:sourceIndexPath.row];
                [self.tblTableView moveRowAtIndexPath:indexPathOfLastItem toIndexPath:0];

                UITableViewCell *cell = [self.tblTableView cellForRowAtIndexPath:sourceIndexPath];
                cell.hidden = NO;
                cell.alpha = 0.0;
            }
        }

        else if (indexpath == 0){

            if ([sourceIndexPath isEqual:[self lastIndexPath]]) {

                NSIndexPath *indexPathOfLastItem =[NSIndexPath indexPathForRow:([self.namesArray count] - 1) inSection:0];
                NSLog(@"last :::: %@",indexPathOfLastItem);

                [self.namesArray exchangeObjectAtIndex:indexpath.row withObjectAtIndex:sourceIndexPath.row];

                [self.tblTableView moveRowAtIndexPath:indexPathOfLastItem toIndexPath:indexpath];

            }
        }
        break;
    }

    default: {
        UITableViewCell *cell = [self.tblTableView cellForRowAtIndexPath:sourceIndexPath];
        cell.hidden = NO;
        cell.alpha = 0.0;

        [UIView animateWithDuration:0.25 animations:^{

            snapshotView.center = cell.center;
            snapshotView.transform = CGAffineTransformIdentity;
            snapshotView.alpha = 0.0;
            cell.alpha = 1.0;

        } completion:^(BOOL finished) {

            sourceIndexPath = nil;
            [snapshotView removeFromSuperview];
            snapshotView = nil;

        }];

        break;
    }
}
}

ABAddressBookCopyArrayOfAllPeople not displaying all contacts

This is the code that i am using to fetch all the contact details in my iphone.It is working allright,But not all the contacts are displayed here.ANy idea why it is happening?By using addresspicker,i can see all those missing names and numbers.

-(void)viewWillAppear:(BOOL)animated { ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);

    __block BOOL accessGranted = NO;

    if (ABAddressBookRequestAccessWithCompletion != NULL)
    { // We are on iOS 6
        dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);

        ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
            accessGranted = granted;
            dispatch_semaphore_signal(semaphore);
        });

        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
            }

    else { // We are on iOS 5 or Older
        accessGranted = YES;
        [self getContactsWithAddressBook:addressBook];
    }

    if (accessGranted) {
        [self getContactsWithAddressBook:addressBook];
    }


}

// Get the contacts.
- (void)getContactsWithAddressBook:(ABAddressBookRef )addressBook {

    contactList = [[NSMutableArray alloc] init];
    CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
    CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);

    for (int i=0;i < nPeople;i++) {
        NSMutableDictionary *dOfPerson=[NSMutableDictionary dictionary];

        ABRecordRef ref = CFArrayGetValueAtIndex(allPeople,i);

        //For username and surname
        ABMultiValueRef phones =(__bridge ABMultiValueRef)((__bridge NSString*)ABRecordCopyValue(ref, kABPersonPhoneProperty));

        CFStringRef firstName, lastName;
        firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
        lastName  = ABRecordCopyValue(ref, kABPersonLastNameProperty);
        [dOfPerson setObject:[NSString stringWithFormat:@"%@ %@", firstName, lastName] forKey:@"name"];

        //For Email ids
        ABMutableMultiValueRef eMail  = ABRecordCopyValue(ref, kABPersonEmailProperty);
        if(ABMultiValueGetCount(eMail) > 0) {
            [dOfPerson setObject:(__bridge NSString *)ABMultiValueCopyValueAtIndex(eMail, 0) forKey:@"email"];

        }

        //For Phone number
        NSString* mobileLabel;

        for(CFIndex i = 0; i < ABMultiValueGetCount(phones); i++) {
            mobileLabel = (__bridge NSString*)ABMultiValueCopyLabelAtIndex(phones, i);
            if([mobileLabel isEqualToString:(NSString *)kABPersonPhoneMobileLabel])
            {
                [dOfPerson setObject:(__bridge NSString*)ABMultiValueCopyValueAtIndex(phones, i) forKey:@"Phone"];
            }
            else if ([mobileLabel isEqualToString:(NSString*)kABPersonPhoneIPhoneLabel])
            {
                [dOfPerson setObject:(__bridge NSString*)ABMultiValueCopyValueAtIndex(phones, i) forKey:@"Phone"];
                break ;
            }

        }
        [contactList addObject:dOfPerson];

    }
    NSLog(@"Contacts = %@",contactList);
    [self.tableView reloadData];
}

How to integrate Appodeal SDK (Mobile Mediation Ad Network) in my app?

How and Where to integrate Appodeal SDK, i can not find any documentation.

(Appodeal is a Mobile Mediation Ad Network, which have several ad networks integrated and serve ads based on Revenue)

Hot to make iOS FBSDKProfilePictureView Round

I'm trying to making a FBSDKProfilePictureView rounded but I can't.

This what I have:

ViewController.h

@property (weak, nonatomic) IBOutlet FBSDKProfilePictureView *fbPhoto;

ViewController.m on ViewDidLoad

self.fbPhoto.layer.cornerRadius = 30.0;
self.fbPhoto.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.fbPhoto.layer.borderWidth = 1.0;

It makes a round circle in front of the UIIMage but it doesn't "crop" the image.

How can i do it

how to create invoice using ApI in ios

I tried to create invoice of paypal using the follwing url invoiceurl

I wrote the following code

 NSURL *url = [NSURL  URLWithString:@"http://ift.tt/1rqEcHT"];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSData *requestData = [NSData dataWithBytes:[jsonString UTF8String] length:[jsonString length]];

[request setHTTPMethod:@"POST"];
[request setValue:@"sender_ssa_api1.gmail.com" forHTTPHeaderField:@"X-PAYPAL-SECURITY-USERID"];
[request setValue:@"AYL24E5YABQJ7S3Q" forHTTPHeaderField:@"PAYPAL-SECURITY-PASSWORD"];
[request setValue:@"A9kCtldabx3cNH-JvrasyD5dOesXAF61m6tDSZ.A7OCniSLwPFV0-A5e" forHTTPHeaderField:@"X-PAYPAL-SECURITY-USERID"];
[request setValue:@"APP-80W284485P519543T" forHTTPHeaderField:@"X-PAYPAL-APPLICATION-ID"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];

[NSURLConnection connectionWithRequest:request delegate:self];
}

- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
 NSMutableData *d = [NSMutableData data];
 [d appendData:data];

NSString *a = [[NSString alloc] initWithData:d encoding:NSASCIIStringEncoding];

NSLog(@"Data: %@", a);
}

I got authentication error. Please help me how to do it in ios.

thanks inadvance

Connection to assetsd was interrupted or assetsd died (with memory warnings)

We are trying to let users import picture from their albums(UIImagePickerController) and also we are scaling/resizing down images that are greater than 8 megapixels(iPhone standard).

But every time the app crashes with Connection to assetsd was interrupted or assetsd died and Received memory warning warnings after or before importing picture.At times Received memory warning warning pops up when still looking for picture to import in UIImagePickerController.

Specially on iPhone 4S this is worse, please help us in optimising our code so that it runs without warnings and crashes on older devices like iPhone 4S or iPad 2.

Let us know if we are doing anything wrong in scaling/resizing down image using CoreGraphics.(Because this is where huge memory is used).

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        UIImage *selectedImage=[info objectForKey:UIImagePickerControllerOriginalImage];
        if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)
        {
            [picker dismissViewControllerAnimated:YES completion:nil];
        }
        else
        {
            [popoverController dismissPopoverAnimated:YES];
            [self popoverControllerDidDismissPopover:popoverController];
        }

        // COMPRESSING IMAGE
        NSData   *selectedImageData=UIImageJPEGRepresentation(selectedImage, 0.1);
        UIImage *selectedImageFromData=[UIImage imageWithData:selectedImageData];

        // IMAGE ASPECT RATIO
        CGFloat originalWidth=selectedImageFromData.size.width;
        CGFloat originalHeight=selectedImageFromData.size.height;
        CGFloat myWidth=2048;
        CGFloat myHeight=2048;
        CGFloat widthRatio=myWidth/originalWidth;
        CGFloat heightRatio=myHeight/originalHeight;
        CGFloat dynamicWidth=heightRatio*originalWidth;
        CGFloat dynamicHeight=widthRatio*originalHeight;


        //SCALING UIIMAGE MORE THAN 8 MEGAPIXELS
        if (((selectedImageFromData.size.width>3264) && (selectedImageFromData.size.height>2448)) || ((selectedImageFromData.size.height>3264) && (selectedImageFromData.size.width>2448)))
        {



             // DATA FROM UIIMAGE TO CORE GRAPHICS
             CGImageRef CoreGraphicsImage=selectedImageFromData.CGImage;
            CGColorSpaceRef colorSpace = CGImageGetColorSpace(CoreGraphicsImage);
            CGBitmapInfo bitmapInfo=CGImageGetBitmapInfo(CoreGraphicsImage);
            CGImageGetBitsPerComponent(CoreGraphicsImage);


            // RESIZING WIDTH OF THE IMAGE
            if (originalWidth>originalHeight)
            {


            CGContextRef context=CGBitmapContextCreate(NULL, myWidth, dynamicHeight, CGImageGetBitsPerComponent(CoreGraphicsImage), CGImageGetBytesPerRow(CoreGraphicsImage), colorSpace, bitmapInfo);


            CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
            CGContextDrawImage(context, CGRectMake(0, 0, myWidth, dynamicHeight), CoreGraphicsImage);
            CGImageRef CGscaledImage=CGBitmapContextCreateImage(context);
                UIImage *CGLastimage = [UIImage imageWithCGImage: CGscaledImage];
                NSLog(@"%f",CGLastimage.size.width);
                NSLog(@"%f",CGLastimage.size.height);

                VisualEffectImageVIew.image=CGLastimage;
                BackgroundImageView.image=CGLastimage;
                ForegroundImageView.image=CGLastimage;
            }


            //RESIZING HEIGHT OF THE IMAGE
            if (originalHeight>originalWidth)
            {
                CGContextRef context=CGBitmapContextCreate(NULL, dynamicWidth, myHeight, CGImageGetBitsPerComponent(CoreGraphicsImage), CGImageGetBytesPerRow(CoreGraphicsImage), colorSpace, bitmapInfo);


                CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
                CGContextDrawImage(context, CGRectMake(0, 0, dynamicWidth, myHeight), CoreGraphicsImage);
                CGImageRef CGscaledImage=CGBitmapContextCreateImage(context);
                UIImage *CGLastimage = [UIImage imageWithCGImage: CGscaledImage];

                NSLog(@"%f",CGLastimage.size.width);
                NSLog(@"%f",CGLastimage.size.height);

                VisualEffectImageVIew.image=CGLastimage;
                BackgroundImageView.image=CGLastimage;
                ForegroundImageView.image=CGLastimage;

            }


        }
        else
        {
            NSLog(@" HEIGHT %f",selectedImageFromData.size.height);
            NSLog(@" WIDTH %f",selectedImageFromData.size.width);

        VisualEffectImageVIew.image=selectedImageFromData;
        BackgroundImageView.image=selectedImageFromData;
        ForegroundImageView.image=selectedImageFromData;
        }


    }

Memory Report

when scrolling in UIImagePickerController

http://ift.tt/1PwuBMq

when scaling/resizing UIImage

http://ift.tt/1cysc83

Is MultiTasking affects the bettery life

I had read the document about multitasking. i comes to know that iphone and ipad does not support multitasking because Multitasking affects the Battery Life. Its is true? or if is it true then ...

How MultiTasking Affects the Bettery Life?

rotating radar on Map Overlay in Map overlays

In my App, there is rotating Radar display over current location. I have created circular overlay on Map over current location with gray colour but I need to make overlay such a way like it is rotating on map like a clock and fill up with gray colour. I have tried a lot but could not get the proper solution over Map overlay. Anyone have any idea how to get this done?

Thanks.!

vendredi 8 mai 2015

Compatible Video recording for both android and iPhone

I am trying to create a video in iPhone using following settings

NSInteger audioBitRate =  64000;
unsigned int channels = 1;
double sampleRate = 44100;


NSDictionary *audioSettings = @{ AVFormatIDKey : @(kAudioFormatMPEG4AAC),
                                 AVNumberOfChannelsKey : @(channels),
                                 AVSampleRateKey :  @(sampleRate),
                                 AVEncoderBitRateKey : @(audioBitRate),
                                 };





NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cacheDirectory = [cachePaths firstObject];
NSString *filePath = [cacheDirectory stringByAppendingPathComponent:videoFileName];
[[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
NSURL *outputURL = [[NSURL alloc] initFileURLWithPath:filePath];

 movieFilePath = filePath;


NSError *errors;
assetWriter = [[AVAssetWriter alloc] initWithURL:outputURL fileType:AVFileTypeMPEG4 error:&errors];

assetWriter.shouldOptimizeForNetworkUse = YES;


NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                            [NSNumber numberWithInt:videoWidth], AVVideoCleanApertureWidthKey,
                                            [NSNumber numberWithInt:videoHeight], AVVideoCleanApertureHeightKey,
                                            [NSNumber numberWithInt:10], AVVideoCleanApertureHorizontalOffsetKey,
                                            [NSNumber numberWithInt:10], AVVideoCleanApertureVerticalOffsetKey,
                                            nil];


CGFloat videoBitRate = 960*1000;
NSInteger videoFrameRate = 30;
NSDictionary *compressionSettings = @{ AVVideoAverageBitRateKey : @(videoBitRate),
                                       AVVideoMaxKeyFrameIntervalKey : @(videoFrameRate),
                                       AVVideoCleanApertureKey : videoCleanApertureSettings };



NSDictionary *videoSettings = @{ AVVideoCodecKey : AVVideoCodecH264,
                                 AVVideoScalingModeKey : AVVideoScalingModeResizeAspectFill, //AVVideoScalingModeResizeAspectFill //AVVideoScalingModeResizeAspect
                                 AVVideoWidthKey : @(videoWidth), //videoDimensions.width //480 //720 //486 //videoWidth
                                 AVVideoHeightKey : @(videoHeight), //videoDimensions.height //640 //1280 //videoHeight
                                 AVVideoCompressionPropertiesKey : compressionSettings };




videoWriteInput = [[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
audioWriteInput = [[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeAudio outputSettings:audioSettings];

audioWriteInput.expectsMediaDataInRealTime = YES;
videoWriteInput.expectsMediaDataInRealTime = YES;

assetWriter.movieTimeScale = 30;
videoWriteInput.mediaTimeScale = 30;

This video is in mp4 but i am not sure why Android MediaPlayer is unable to run this video. Doesn't even play in VideoView too.

What should be appropriate settings?

Check if text file in directory to show direct

I am developing an IOS app..Firstly download the text file from url and save into directory..and file save into directory..But check if the file has been directory to not download the file direct show the text..Else file not in the directory to download the file than show the text fie..But Running the project file download again and again..

code..

if ([[NSFileManager defaultManager] fileExistsAtPath:localfile]) {
         content = [NSString stringWithContentsOfFile:localfile
                                            encoding:NSUTF8StringEncoding
                                               error:NULL];
    }else
    {
        NSURL* url = [NSURL URLWithString:@"http://ift.tt/1InmjaW"];

    NSArray* pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                             NSUserDomainMask, YES);
    NSString* documentsDir = [pathArray objectAtIndex:0];
    localfile =[documentsDir stringByAppendingPathComponent:@"data"];
        NSData* data = [NSData dataWithContentsOfURL:url];
    [data writeToFile:localfile atomically:YES];
    content = [NSString stringWithContentsOfFile:localfile
                                        encoding:NSUTF8StringEncoding
                                         error:NULL];
}
_textfield.text=content;

How to integrate Recurly gateway in iOS apps

In my application I need to integrate payment gateway "Recurly" (recurly.com). is it possible to integrate it in ios apps? if so please give me integration document.

Thanks in Advance.

SKReceiptRefreshRequest not working the second time it is called after a cancel

My app starts and checks for the receipt. Because it is sandbox, the first time the app runs from xcode, it needs to ask the app store for the receipt. So I use SKReceiptRefreshRequest to request it.

A window pops up, asking for the app store credentials. If I type the credentials, then the app loads the receipt, I validate it, and the app runs fine.

The problem starts if I cancel that credential window.

Then I have the first problem. At this time the app has no receipt, so I cannot validate to see if the copy is pirate. What to do? I tried the following approach: instead of disabling the application, when the user tries to use the app, I show a window saying "could not validate the application, type OK to validate now".

When the user types OK, I trigger SKReceiptRefreshRequest a second time. Again a credential window pops up, I type the valid credentials and nothing happens. After 2 or 3 minutes of nothingness, a windows pops up saying "cannot connect to App Store".

The strange part is that none request:didFailWithError: or requestDidFinish: methods of SKReceiptRefreshRequest delegate are called during this failure. Receipt retrieval fails without triggering any delegate method and yes, the delegate is assigned.

The code for the receipt retrieval is the traditional one, that is

SKReceiptRefreshRequest *refreshReceiptRequest = [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:nil];
refreshReceiptRequest.delegate = self;
[refreshReceiptRequest start];

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
  NSLog(@"ERROR");
}

- (void)requestDidFinish:(SKRequest *)request {
  if([request isKindOfClass:[SKReceiptRefreshRequest class]])
  {
    NSLog(@"App Receipt exists after refresh");
  } else {
    NSLog(@"Receipt request done but there is no receipt");
  }
}

Cannot download images from apple website?

generally one can download the images from any website by right clicking and selecting save image as.. but its not possible in apple website http://ift.tt/1iNCFrt , also they are using <figure> tag- for example-

<div id="gallery-iphone-6-gold" class="gallery-content">
    <figure class="iphone-6-gold-image"></figure>
    <p>Gold</p>
</div>

Swift: keyboard blocking text view

I have a Text View at the bottom of a UIView, so when touch the text view and the keyboard shows up, the keyboard will block the text view. How can I solve this problem? Can I make the whole UIView move up when the keyboard shows up? so that the keyboard will not block anything

Searching of data in uitableview through uitextbox in ios

How can i do search on table view without using search controllers and search bars. I only want to search through values given by user in textboxes and when user click on SEARCH BUTTON, the uitableview show record.. Kindly help..

what size background images I need for ios devices

I am just trying to learn iOS development using xcode. I want to create a background image that works on all iOS devices. Of course the background image suppose to take the whole screen. Do I need to create a multiple images for different iOS devices? If I am using photoshop to create these images, what should the size of my images?

for example in apple guide, I see For iPhone 6: 750 x 1334 (@2x) for portrait 1334 x 750 (@2x) for landscape

For iPhone 6 Plus: 1242 x 2208 (@3x) for portrait 2208 x 1242 (@3x) for landscape

does this means I have to create the same image in 4 different sizes to work for iphone 6 and and iphone6 plus? what other sizes I need for iphone4, 4s, 5 and 5s?

Thanks

How can I connect a device to an iPhone app that are both on the same wireless network?

I'm trying to learn how to build an app that allows you to connect a device to an iPhone app over WIFI so that I can control the device through my iPhone. I just want to know what line of code I would need to incorporate to the app, in order to perform this task?