How to make a duplicated target work in Xcode 4? - xcode

I've duplicated a target in Xcode 4, but when I hit run, the application starts and gets stuck in the launching screen and I've got an error in the Xcode console:
error: failed to attach to process ID 3957
I've already searched on the internet for some possible solutions but all of them didn't seem to solve this issue.
Any other clues?

When you duplicate the target, the project will try to use the same bundle ID. Which in some cases is not what you want. Try changing it if you don't need to use the same bundle identifier.

Step1: ping
$ ping localhost
This should return something like
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.048 ms
...
If this works, this answer won't fix your problem, try something else.
If ping return something else for example: ping: cannot resolve localhost: Unknown host something is screwed up with your /etc/hosts file, go to Step 2
Step2: Check /etc/hosts
Check that the top of your /etc/hosts file looks like this
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
If it doesn't have these entries in the file, enter them at the top of the file, flush the dns cache using $ dscacheutil -flushcache and go back to Step 1, otherwise continue to Step 3.
Step3: Correct File Format: It should be unix or LF *
$ file /etc/hosts
This should return: /etc/hosts: ASCII English text
If it returns something like /etc/hosts: ASCII English text, with CR line terminators then the file is in the wrong format and is likely being ignored.
Change the file line endings to unix or LF using your favorite text editor.
In Sublime Text 2 this can be done throught the view menue: View > Line Endings > Unix
Flush the dns cache ($ dscacheutil -flushcache) and go back to step 1

Related

Why does changing a hostname in the hosts file not change my computer name?

I have to run some servers with different names. So I changed the hostname in Windows 10 inside C:\Windows\System32\drivers\etc\hosts. I changed the name from localhost to brandcil.local:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 brandcil.local
# ::1 brandcil.local
Now when I am running nslookup 127.0.0.1 in powershell terminal, it is showing this:
Server: UnKnown
Address: 192.168.43.1
Name: localhost
Address: 127.0.0.1
I restarted my machine but it does not take effect. How do I change the hostname then?
Changing the hosts file will not change the hostname. It is only used for hostname-IP-resolution. Besides that, each line that begins with # is a comment and not an active configuration. You can rename a computer with the following PowerShell cmdlet:
Rename-Computer -NewName brandcil -Restart
First of all, any line in the hosts file that begins with # is a comment and will be ignored. The file itself tells you this if you read it. Second, the hosts file has nothing to do with your computer's hostname. All you're doing is creating aliases that will only work on the machines you modify the hosts file on. You're not changing the hostname at all. Third, localhost -> 127.0.0.1 is a static mapping no longer controlled by the hosts file so it will always map to 127.0.0.1. Again, the hosts file tells you this if you read it.
To rename your computer go into Settings --> System --> About. There's a "Rename this PC" button.
If you don't want to use that, then I recommend using the Rename-Computer Powershell command.

Shell (bash) snmpset script tells Error in packet WrongLength

Hi i have written the bash script for downloading configuration from switches and save it to TFTP server.
snmpset -v 2c -c Zaloznik 192.168.50.22 1.3.6.1.4.1.1991.1.1.2.1.6.0 s test_skript.cfg 1.3.6.1.4.1.1991.1.1.2.1.66.0 x C0A846D2 1.3.6.1.4.1.1991.1.1.2.1.9.0 i 22 >> /dev/null;
But it always tell me this:
Error in packet. Reason: wrongLength (The set value has an illegal
length from what the agent expects) Failed object:
iso.3.6.1.4.1.1991.1.1.2.1.66.0
C0A846D2 is a HEX format of ip 192.168.70.210.
Don't you know how to fix it ? Please help, i have tried many combinations and nothing working.
Thanks.
Problem solved, there was a problem with switches that want to have an info about
type of ip address (ipv4 or ipv6), then ip address of tftp, file name and after that he can send config files to tftp.
So i have to add another snmp OID (ip address type) into the script and then it works.

Hostnames resolution fails with "unknown host" error for hostnames containing utf-8 characters

I am trying to ping a hostname "win-2k12r2-addc.阿伯测阿伯测ad.hai.com" from a linux client.
I see that DNS requests go over the wire with hostname being sent in utf-8 format
and i get a response from the DNS server also with the correct IP address.
But ping fails with the following error :
ping: unknown host win-2k12r2-addc.阿伯测阿伯测ad.hai.com
If i add an entry into /etc/hosts, it works fine
I have the following entries in /etc/hosts when it works.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
127.0.0.1 localhost ava-dev
::1 localhost
10.141.33.93 win-2k12r2-addc.阿伯测阿伯测ad.hai.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The /etc/nsswitch.conf file has the following entries for hosts.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hosts: files dns
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I somewhat suspect that getaddrInfo() call fails when we try to resolve the address i.e it is not able to handle the DNS responses correctly for hostnames
containing unicode characters.
Has anyone faced this issue before ?
Or has anyone tried resolving a unicode hostname from a linux client ?
The reason i m suspecting getaddrinfo() is because of the following.
Apart from ping, i m trying the following ldap command to the same host and it fails with the below mentioned error
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ldapsearch -d 255 -x -h win-2k12r2-addc.阿伯测阿伯测ad.hai.com
ldap_create
ldap_url_parse_ext(ldap://win-2k12r2-addc.%E9%98%BF%E4%BC%AF%E6%B5%8B%E9%98%BF%E4%BC%AF%E6%B5%8Bad.hai.com)
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP win-2k12r2-addc.阿伯测阿伯测ad.hai.com:389
ldap_connect_to_host: getaddrinfo failed: Name or service not known
ldap_err2string
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In both the scenarios (ping / ldap), i see the DNS query request going to the DNS server and the correct response from the DNS server back to the linux client.
The following is the value of the hostname sent in the DNS query
win-2k12r2-addc.\351\230\277\344\274\257\346\265\213\351\230\277\344\274\257\346\265\213ad.hai.com: type A, class IN
It looks like you are trying to use UTF-8 or unicode within the DNS system while the DNS system really doesn't like that. It wants ascii (See RFCs 5890, 5891, 5892, 5893 - but mostly 5891). Escaping the utf-8 characters does not turn them into the required ascii encoding, called punycode (prefixed by "xn--"). You want to use the version of your IDN that has punycode instead of the UTF-8:
ping win-2k12r2-addc.xn--ad-tl3ca3569aba8944eca.hai.com

Entries in host file at particular line

I am looking for a script that can add host entries in a windows 7 host files at particular lines or just after the default text in host file.
I came across this thread in your forum here that can add/remove the lines perfectly but it adds the lines at the end of the file not at the top. can you please help with the same?
hey thanks for the link.
Since i have limited exposure to batch files, I wanted to check that method offline first
1) created a txt file dns.txt with some DNS entries
1.2.3.4 abcd.com
2.3.4.5 bcde.com
3.4.5.6 cdef.com
4.5.6.7 defg.com
2) created a batch file with one line code in it:
for /F %%i in (c:\temp\dns.txt) do echo %%i >> "D:\hosts"
3) but when i check the host file, it only has IP entries and not the hostnames against it.
==================
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
1.2.3.4
2.3.4.5
3.4.5.6
4.5.6.7
====================
what is wrong !!?

Xcode error: failed to launch [directory] -- invalid host string: 'localhost'

I am trying to run in command line tool the following code:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
#autoreleasepool {
// insert code here...
NSLog(#"Hello, World!");
}
return 0;
}
and after "Build Succeeded" I am getting the following error:
error: failed to launch '/Users/dimitrisagagiotis/Library/Developer/Xcode/DerivedData/test-guvgymeaqzlsheascqbmllxdtpsn/Build/Products/Debug/test' -- invalid host string: 'localhost'
any solution??? Thank you
I had the same issue and resolved it with the following steps.
You have to verify that the following lines are included in the /etc/hosts file
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
Execute dscacheutil -flushcache to reload the DNS configuration
I have absolutely no idea how it was possible to get a host file without the loopback DNS entries to localhost. From this point of view, "invalid host string: 'localhost'" is pretty self-describing: localhost is a invalid host string to the system, it simply can not resolve localhost.
Xcode error Invalid string localhost
open terminal
//type
sudo nano /etc/hosts
// it may ask for password , enter the password;
// copy and paste this
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
then press control-o and then press enter and then press control-x
//then type
dscacheutil -flushcache
//use Xcode for c & c++ without internet !
In addition to checking that the correct lines are in the hosts file check that line endings are "Unix" and not some other kind of line ending. This solved the problem for me.

Resources