I'm new to Eclipse and Android and I need to align controls to each other.

In Visual Studio, I can easily align controls and distribute spaces between them. How can I do this in Eclipse?

I got this xml. Just dragged and dropped them to layout. There must be an easy way to align and disstribute. Especially distrubute.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
tools:context="com.example.sbs.MainActivity" >
<!-- Ders adları -->
    android:text="@string/Turkce" />

      android:text="@string/ingilizce" />

      android:text="@string/Matematik" />

      android:text="@string/FenveTeknoloji" />

      android:text="@string/tarih" />

      android:text="@string/din" />

i want to get all articles from the shopware api(http://wiki.shopware.de/Shopware-API_cat_919.html) but the i dont get the data into an NSDictionary url i call: http://myshop.com/api/articles

here is the source i got

NSURL *url = [NSURL URLWithString:weburl];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [NSURLConnection sendAsynchronousRequest:request
                                       queue:[NSOperationQueue mainQueue]
                           completionHandler:^(NSURLResponse *response,
                                   NSData *data, NSError *connectionError) {

                               if (data.length > 0 && connectionError == nil) {

                                   NSDictionary *rest_data = [NSJSONSerialization JSONObjectWithData:data

                                   _newsDataForTable = [NSMutableArray array];
                                   NSDictionary *news;
                                   for (id key in rest_data[@"postalcodes"]) {
                                       news = [rest_data[@"postalcodes"] objectForKey:key];

                                   int iterator = 0;
                                   for (id key in news) {
                                       [_newsDataForTable insertObject:key[@"title"] atIndex:iterator];

                                   [_newsTable reloadData];
                                   [_newsTable numberOfRowsInSection:[_newsDataForTable count]];
                                   [_newsTable reloadRowsAtIndexPaths:0 withRowAnimation:UITableViewRowAnimationLeft];



I have a problem about converting.

print "\357\274\221\357\274\221" # 11 , no problem!

In python, it works!

NSLog(@"outCommand:%@", @"\357\274\221\357\274\221");// 1 , loses another letter!
NSLog(@"outCommand:%@", [@"\357\274\221\357\274\221" dataUsingEncoding:NSUTF8StringEncoding]);// <efbc91ef bc91>

How can I convert it correctly in Objective-C or Swift on iOS?

I have been trying to add automatic formatting for one of the textfields in my app in order for it to automatically format values that the user enters into date format.

This is my code:

    func textField(textField: UITextField!, shouldChangeCharactersInRange range: NSRange, replacementString string: NSString!) -> Bool {
    var formatter = NSNumberFormatter()

    if string.length == 0 {
        formatter.groupingSeparator = "-"
        formatter.groupingSize = 4
        formatter.usesGroupingSeparator = true
        formatter.secondaryGroupingSize = 2

        var num: NSString = transactionDateInput.text
        num = num.stringByReplacingOccurrencesOfString("-", withString: "")
        var str: NSString = formatter.stringFromNumber(NSNumber.numberWithDouble(num.doubleValue))
        transactionDateInput.text = str
        return true
    } else {
        formatter.groupingSeparator = "-"
        formatter.groupingSize = 2
        formatter.usesGroupingSeparator = true
        formatter.secondaryGroupingSize = 2

        var num: NSString = transactionDateInput.text
        if num.isEqualToString("") {
            num = num.stringByReplacingOccurrencesOfString("-", withString: "")
            var str: NSString = formatter.stringFromNumber(NSNumber.numberWithDouble(num.doubleValue))
            transactionDateInput.text = str
        return true

The problem is that when typing into the text field, no formatting occurs.

I have set the delegate of the text field to be the view controller, but am I missing some other connection that I need? Or is the issue something else?

I'm trying to update an app for iOS8, which has a chat interface, but the new Quicktype keyboard hides the text view, so I would like to turn it off programmatically or in interface builder.

Is it possible somehow or only the users can turn it off in the device settings?

For some unknown reason there seems to be a possible bug with all screenshot methods on the iPhone 6 simulator (and device). Whenever I call any of the screenshot methods including:

snapshotViewAfterScreenUpdates: resizableSnapshotViewFromRect: drawViewHierarchyInRect:

with afterScreenUpdates set to YES, the screen flickers. If set to NO, then no flicker occurs, but I am unable to get the functionality that I need.

These methods work fine with both iOS7.1 and iOS8 in all other simulators except for the iPhone 6 and 6+.

Strangely enough, if I start a brand new project using storyboards and try similar code I can't reproduce the flicker. I have attached a gif of the flicker using my non-storyboard project:

enter image description here

And here is the very simple view controller:

    @implementation TestSnapshotController

- (void)viewDidLoad
    [super viewDidLoad];

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Snap" style:UIBarButtonItemStylePlain target:self action:@selector(_snap)];

    self.blueView = [UIView new];
    self.blueView.backgroundColor = [UIColor blueColor];
    self.blueView.frame = CGRectMake(100.0f, 100.0f, 100.0f, 100.0f);
    [self.view addSubview:self.blueView];

- (void)_snap
    [self.blueView snapshotViewAfterScreenUpdates:YES];


And here is my AppDelegate just in case:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    TestSnapshotController *testVC = [TestSnapshotController new];
    UINavigationController *rootNavVC = [[UINavigationController alloc] initWithRootViewController:testVC];

    self.window.rootViewController = rootNavVC;
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    return YES;

Any help would be greatly appreciated!

I have one problem with my app, I would like to set different options for SMS (whats'app, etc.) and for calls that I receive, vibration for sms and ringtone for calls, is possible?

I have an existing localised application with several Main.strings files.

Now, I add several objects like UILabel for example.

How can I add these strings in the existing Main.strings files?


I currently do that manually by opening each Main.strings file and copying an existing translation:

/* Class = "IBUILabel"; text = "Developped by"; ObjectID = "SKE-KN-dba"; */
"SKE-KN-dba.text" = "Developped by";

/* Class = "IBUILabel"; text = "I change this text"; ObjectID = "Object ID"; */
"Object ID.text" = "I change this text";

Where I take the "Object ID" value from the Objet's identity inspector.

Don't know if it exists a better way.

I'm using SocketRocket, a WebSockets library for iOS and it is incompatible with SocketIO since SocketRocket is purely web sockets. So, in order to be able to use SocketRocket in my iOS app, I decided to use ws for my server side, since it offers the simple functionality that I want. I tested a demo and my app was able to connect through SocketRocket. However, one feature I miss from SocketIO was the easy middleware implementation to check for authentication (if the user was logged in). Is there a way for me to "ensure authenticated" on receive message on the server side?

I know that this question has been asked a lot of times and I think I've read them all but I still can't solve my bug. This is my code:

lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
    // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
    // Create the coordinator and store
    let storePath = self.applicationDocumentsDirectory.path?.stringByAppendingPathComponent("name.sqlite")
    let fileManager : NSFileManager = NSFileManager.defaultManager()
    var fileCopyError:NSError? = NSError()
    if !fileManager.fileExistsAtPath(storePath!) {
        let defaultStorePath : NSString! = NSBundle.mainBundle().pathForResource("name", ofType: "sqlite")
        if((defaultStorePath) != nil) {
            fileManager.copyItemAtPath(defaultStorePath, toPath: storePath!, error: &fileCopyError)
    var coordinator: NSPersistentStoreCoordinator?
    coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
    let url = NSURL(fileURLWithPath: storePath!)
    var error: NSError? = nil
    var failureReason = "There was an error creating or loading the application's saved data."
    if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil {
        coordinator = nil
        // Report any error we got.
        let dict = NSMutableDictionary()
        dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
        dict[NSLocalizedFailureReasonErrorKey] = failureReason
        dict[NSUnderlyingErrorKey] = error
        error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
        // Replace this with code to handle the error appropriately.
        // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
        NSLog("Unresolved error \(error), \(error!.userInfo)")

    return coordinator

The problem is that it copies a .sqlite file with the name I used but is empty.

EDIT: FYI I have already cleaned build folder and reseted iPhone Simulator.

I'm wondering, how to implement a simple feedback like on this picture below in my iOS app. I used to resolve feedbacks with MFMailComposeView , but this is cooler. Any ideas? picture

I am trying to implement a scrollview, and while the easiest way to do this has always been to set contentSize, I am trying to do things “the right way” and my understanding is that it is now possible to do the entire thing in IB by pinning child views to the top/left/right/bottom edges.

I’ve done this and it really seems like it should be working. The bottom most subview is displayed off screen (see iOS 8 view debugging) and the constraints are all as I understand they should be, but the view still does not scroll. Per a lot of answers on SO, I have disabled the parent VC’s adjust scrollView insets property.

Attached images:

320px green bar is the subview which I thought would cause scrolling: 320px green bar is the subview which I thought would cause scrolling

Constraints for the scrollview and all child views: Constraints for the scrollview and all child views

Any thoughts about what is going wrong?

I am looking for a way to identify a subview object while iterating inside a for-loop, I basically get all subviews from a UITableView's contentView by doing cell.contentView.subviews.

for SubView in cell.contentView.subviews {
   // check if it's the correct subview

basically thats how I get the subview objects into a loop, while I can see that I got multiple objects in there I need to somehow identify these, in C# a key named simply as name is defined as such:

object.name = "something"

and then retreived in a for-loop by:


but this doesn't seem to be a possibility in Swift, how would I go about identifying an object if I got multiple occurrences of let's say a UILabel?

This question is not a repost of my previous question, but a continuation - How to embed formulas in libxl for ios

When i try to add numbers electronically with formulas, they are not formulating. They are showing up as "0".

I Think it has something to do with the"0" in "xlSheetWriteFormula(sheet, 9, 1, "SUM(B5:B6)", 0);"

Here is my code -

- (IBAction)createExcel:(id)sender

    BookHandle book = xlCreateBook(); // use xlCreateXMLBook() for working with xlsx files

    SheetHandle sheet = xlBookAddSheet(book, "Sheet1", NULL);

    xlSheetWriteNum(sheet, 2, 1, 40, 0);
    xlSheetWriteNum(sheet,3, 1, 30, 0);
    xlSheetWriteNum(sheet, 4, 1, 50, 0);
    xlSheetWriteNum(sheet, 5, 1, 40, 0);
    xlSheetWriteNum(sheet,6, 1, 30, 0);
    xlSheetWriteNum(sheet, 7, 1, 50, 0);

    xlSheetWriteFormula(sheet, 9, 1, "SUM(B5:B6)", 0);

    NSString *documentPath =
    [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0];
    NSString *filename = [documentPath stringByAppendingPathComponent:@"insuranceclaim.xls"];

    xlBookSave(book, [filename UTF8String]);


    if (![MFMailComposeViewController canSendMail]) {
        //Show alert that device cannot send email, this is because an email account     hasn't been setup.

    else {

        //**EDIT HERE**
        //Use this to retrieve your recently saved file

        NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0];
        NSString *filename = [documentPath stringByAppendingPathComponent:@"insuranceclaim.xls"];

        //**END OF EDIT**

        NSString *mimeType = @"application/vnd.ms-excel"; //This should be the MIME type for els files. May want to double check.
        NSData *fileData = [NSData dataWithContentsOfFile:filename];
        NSString *fileNameWithExtension =   self.personFirstnameTextField.text; //This is what you want the file to be called on the email along with it's extension:

        //If you want to then delete the file:
        NSError *error;
        if (![[NSFileManager defaultManager] removeItemAtPath:filename error:&error])
            NSLog(@"ERROR REMOVING FILE: %@", [error localizedDescription]);

        //Send email
        MFMailComposeViewController *mailMessage = [[MFMailComposeViewController alloc] init];
        [mailMessage setMailComposeDelegate:self];
        [mailMessage addAttachmentData:fileData mimeType:mimeType fileName:fileNameWithExtension];
        [self presentViewController:mailMessage animated:YES completion:nil];



I was wondering if it is possible to turn push notification sound off inside the App itself without the user going into the iphone settings? I want to give the user the ability to turn notification sound off inside the App itself so no new push notification will make a noise when the App is closed or in background.

I have a problem while archiving my app.

I created a new target for an iOS 8 extension.

When I archive the app, I receive a warning.

The warning is "PBXCp Warning", "warning: skipping copy phase strip, binary is code signed: /Users/Library/Developer/Xcode/DerivedData/App/Build/Intermediates/ArchiveInter mediates/AppName/IntermediateBuildFilesPath/UninstalledProducts/AppExtappex/AppE xt".

The app is in Objective-C.

I recently started out with PhoneGap development and I wanted to check out automated installation that NPM offers. So far I had been manually installing plugins to my PhoneGap project in Eclipse. So I decided to try out the automated process since manual installation was such a pain in the you know where.

What do I have:

  • NodeJS
  • ANT (WinANT)
  • JDK
  • And of course Android SDK

I went through a couple of errors but I was mostly able to resolve them while I followed this link: http://codingsquare.blogspot.in/2013/08/creating-cordova-3-android-project.html

until I reached this command 'cordova -d platform add android'. The error that I get is:

                    throw e;
Error: An error occurred while listing Android targets
    at C:\Users\PSP\.cordova\lib\android\cordova\3.5.1\bin\lib\check_
    at _rejected (C:\Users\PSP\.cordova\lib\android\cordova\3.5.1\bin
    at C:\Users\PSP\.cordova\lib\android\cordova\3.5.1\bin\node_modul
    at Promise.when (C:\Users\PSP\.cordova\lib\android\cordova\3.5.1\
    at Promise.promise.promiseDispatch (C:\Users\PSP\.cordova\lib\and
    at C:\Users\PSP\.cordova\lib\android\cordova\3.5.1\bin\node_modul
    at flush (C:\Users\PSP\.cordova\lib\android\cordova\3.5.1\bin\nod
    at process._tickCallback (node.js:419:13)
Command finished with error code 8: cmd /s /c ""C:\Users\PSP\.cordova
\lib\android\cordova\3.5.1\bin\create.bat" --cli "D:\CaptainBlack\Android SDK\NP
M\pgapp\platforms\android" io.cordova.hellocordova HelloCordova"
Error: cmd: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\PSP\AppData\Roaming\npm\node_m
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Help me please!

I have loaded a WebView in my android app:

webView = (WebView)view.findViewById(R.id.webView);
String url = UrlConstants.URL_CITY;

webView.setWebViewClient(new WebViewClient() {
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
  return true;

But every popUp that is of the website has a transparent background as shown: PopUp with transparent background

I've tried many urls as well: One being this

Anyone help will be appreciated. Thanks

in my app I need to add shadow effect on image loaded in imageview(from url). Below are the things I have tried yet:-

Code for xml :-

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"



Code for shadow_effect_imageview:-

     <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">    

But using these it shows shadow effect on imageview as lazy loading but what I want is to keep same effect on image even after loading image. Will anyone please suggest me on this. Thanks in advance.

First I set the price to 499 INR in India.

Then After some days I set its pricing to 50 INR, then in Google play developer console it displays 50 INR, enter image description here

enter image description here But the problem is it does not reflect this change in play store ! enter image description here

Link : https://play.google.com/store/apps/details?id=com.vivekwarde.superstitions

Even I waited 72 hours !

Any Idea why this so ?


I am trying to upload a data to the server using ajax. It was working fine few days before but know its showing following i check the php page query and all is working fine there is no error on the php page . error log:

09-20 17:47:55.459: I/qtaguid(7555): Failed write_ctrl(t 134 43456479100928 2) res=-1 errno=1
09-20 17:47:55.469: I/qtaguid(7555): Tagging socket 134 with tag 278600000000(10118) for uid 2 failed errno=-1
09-20 17:47:55.469: I/qtaguid(7555): Failed write_ctrl(t 135 43456479100928 2) res=-1 errno=1
09-20 17:47:55.469: I/qtaguid(7555): Tagging socket 135 with tag 278600000000(10118) for uid 2 failed errno=-1
 09-20 17:47:55.469: I/qtaguid(7555): Failed write_ctrl(t 136 43456479100928 2) res=-1 errno=1
 09-20 17:47:55.469: I/qtaguid(7555): Tagging socket 136 with tag 278600000000(10118) for uid 2 failed errno=-1
09-20 17:47:59.593: I/Adreno200-EGLSUB(7555): <ConfigWindowMatch:2078>: Format RGBA_8888.

Any Idea is appreciated.

Thanks in advance.