Tag Archives: xcode

“There was an internal API error” in Xcode debugging;

Visit: here
I wrote a game demo a while ago. I took some time to optimize the following method today. I found that the following errors will be reported when Debugging on iPad.

At the beginning, I thought that I used a private API. Later, I carefully checked that there was no problem. Therefore, I began to use the common debugging method when the real machine debugging went wrong.
1. Necessary good habits, Product –& GT; The clear;
2. Delete the previously debugged program on iPad, run it again, OK, and solve the problem (unexpectedly easy); As for the specific reason, I found that when the error dialog box popped up, it happened to be the detection of certificates such as profile, which might have something to do with the identification detection of the real machine. No matter how much, the problem is solved;
3. I encountered this problem again today. It was found that the apps debugged on the real computer had a profile conflict with some apps on the iPad, that is, they Shared a profile. (added on 14 May 2013)
PS: today may no longer regrets about baidu and Google, don’t know if industry reason, sometimes some problem on the search technology, found that all these results given in baidu and Google really really can’t, the efficiency is too low, turn a few pages is less than what you want, don’t know the reason why is because the algorithm or because baidu too pursuit of commercial cause, so if you have any questions how sometimes asked baidu are not the answer, might as well try Google;

Various errors (c + +)

OS X EI Capitan [10.11.6]
Xcode [8.0]
C++
Code:

#include< iostream>
#include< math.h>
#include”MyComplex.h”
usingnamespacestd;
int main(int argc,constchar * argv[]) {
//insert code here…
MyComplex c1;
MyComplex c2.
Cin & gt; > c1;
C2 = c1;
Cout & lt; < c1 < < endl;
Cout & lt; < c2 < < endl;
MyComplex c3.
C3 = c1 + c2; //error1:No viable overloaded ‘=’
Cout & lt; < c1+c2 < < Lendl; //error2: No matching constructor for initialization of ‘MyComplex’
Cout & lt; < c1-c2 < < Lendl; //error
Cout & lt; < c1/c2 < < Lendl; //error
Cout & lt; < c1*c2 < < Lendl; //error
    
Return0;
}

So how is the overloading of = defined?Look at the code.

MyComplex& operator = (MyComplex & rhs){
Real = RHS. GetReal ();
Imaginary = RHS. GetImaginary ();
Return * this;
}

It doesn’t seem to be a problem. By looking at http://www.cplusplus.com/forum/general/153830/ to find the reason of the error:
A temporary object can’t bind to A non-const reference.
(A temporary object cannot be bound to an extraordinary reference, that is, the bound reference must be constant)
Therefore, the parameter of the overloaded = function must be const. (Such a covert mistake is more than enough to cry about…)
Error1 disappears after adding const:

MyComplex& operator = (constMyComplex & rhs){
Real = RHS. GetReal ();
Imaginary = RHS. GetImaginary ();
Return * this;
}
Error2 has the same error cause.

Friend ostream& operator< < (ostream& os,const MyComplex & c);
Const is very important! Want to! !!! After the correction, the errors disappeared

WebView loadrequest request request error “nsurlconnection finished with error – Code – 1022”

Execute the following code

[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.bing.com"]]];

WebView didFailLoadWithError:(UIWebView *)webView didFailLoadWithError:(NSError *)error printed as follows

1 [6587:75627] NSURLConnection finished with error - code -1022
2 [6587:75574] Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy 
3 requires the use of a secure connection." UserInfo={NSUnderlyingError=0x600000641f50 
4 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires 
5 the use of a secure connection." UserInfo={NSErrorFailingURLStringKey=http://www.bing.com/, 
6 NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.,
7  NSErrorFailingURLKey=http://www.bing.com/}}, NSErrorFailingURLStringKey=http://www.bing.com/, NSErrorFailingURLKey=http://www.bing.com/, 
8 NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}

 
The solution is simple:
URLString must use HTTPS to request the WebView to display properly
 
But then I found out that I had to load http://localhost:8080 and then, sadly, I’m going to have to look at the mechanics, and in XCode 9 I’m going to get an error message that’s pretty obvious

The resource could not be loaded because the App Transport Security policy 

Go to Baidu ATS Policy, you can know the answer in detail, in SupportFiles-> Info.plist file to add the following attributes, there is a direct option, do not need to fill out

done!
 

Reproduced in: https://www.cnblogs.com/zhouhui231/p/8572705.html

swift stdlib tool error is reported after xcode upgrade xcode9 1

The computer was upgraded to 10.13.1, and Xcode was upgraded to Xcode9.1. But when the original operation was ok, swift Stdlib tool error was reported, and DerivedData was searched, re-Pod install, and deleted. The last time I saw a restart, another error occurred after the restart

baidu again, said to set the key string certificate to always trust, the result is still not believe

Xcode:Task failed with exit 1 signal 0 {

The error message is as follows:
was the problem I encountered while trying to build apps and simulate them on my phone.

Solution: When prompted for a password in the key string, press always Allow, rather than simply allow.
If you are currently in this process, restart your computer, then open Xcode and simulate it on a common device, and you will be prompted to re-enter your password. Make sure that clicking is always allowed.

Xcode: error: linker command failed with exit code 1(use -v to see invocation) or libstdc++.6.0 is missing

Note: Refer to the first link
The reason for the error is that iOS10 deleted the libstdc++.6.0.9 library file after the upgrade, so you just need to download it and put it in.
1. Download libstdc++. 6.0.9. TBD
Download Address:
https://pan.baidu.com/s/10gZrtGtspgpKT7qSY-bBDg
2. Download and note that the file name may not be this change file named libstdc++.6.0.9. TBD
3. Place the download file in the specified location
(1) Real machine runtime location
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
(2) Location of the simulator runtime library
/ Applications/Xcode. App/Contents/Developer/Platforms/iPhoneSimulator platform/Developer/SDKs/iPhoneSimulator SDK/usr/lib
(access – to – & gt; Go to folder -& GT; Copy the above location go to find the location and then paste the downloaded file into the lib file and restart Xcode.)

Reference link:
https://blog.csdn.net/w1035524412/article/details/82863840
https://www.jianshu.com/p/a3f3c8361cf1

Solution to (ERROR: Failed to build gem native extension.) encountered when updating pod

A normal update of the POD command

sudo gem install -n /usr/local/bin cocoapods

Normally, if you execute the command above, you can upgrade directly. If you upgrade successfully, everything will be fine.
On the contrary, encounter the following upgrade failed!

➜  Ruby: sudo gem install -n /usr/local/bin cocoapods
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200313-24412-3logr3.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out

This upgrade problem has been plaguing for several days. It may be that the ruby version is incompatible with the latest POD version. Therefore, Ruby must be upgraded before pod can be successfully upgraded.
The method is found on StackOverflow, but of course there are some other exception issues that need to be resolved during installation (by default you have xcode-select installed)
1. Install RVM

curl -L https://get.rvm.io | bash -s stable

If the installation is successful and the following prompts appear, you can proceed directly to step 2

Upgrade of RVM in /Users/mengshun/.rvm/ is complete.

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: https://opencollective.com/rvm/donate

If it fails, appeared at the bottom of the error (error content curl: (7) Failed to connect to port 443 raw.githubusercontent.com: Operation timed out)

➜  Ruby: curl -L https://get.rvm.io | bash -s stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   194  100   194    0     0    166      0  0:00:01  0:00:01 --:--:--   166
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

Execute the following instructions

sudo gem install redis

Then proceed with the RVM installation command (curl -L https://get.rvm.io | basket-s stable)
If you still report 443 errors, wait for a while and try again (I tried 3 times myself).
2. Install Ruby 2.6

➜  Ruby: rvm install ruby-2.6
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.6.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Homebrew libs 'coreutils libyaml [email protected] readline' require update - skipping.
Skipping update of certificates bundle '/usr/local/etc/[email protected]/cert.pem', to force update run:
    rvm osx-ssl-certs update /usr/local/etc/[email protected]/cert.pem

Requirements installation successful.
Installing Ruby from source to: /Users/mengshun/.rvm/rubies/ruby-2.6.3, this may take a while depending on your cpu(s)...
ruby-2.6.3 - #downloading ruby-2.6.3, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.8M  100 13.8M    0     0   9172      0  0:26:21  0:26:21 --:--:-- 11855
ruby-2.6.3 - #extracting ruby-2.6.3 to /Users/mengshun/.rvm/src/ruby-2.6.3 - please wait
ruby-2.6.3 - #configuring - please wait
ruby-2.6.3 - #post-configuration - please wait
ruby-2.6.3 - #compiling - please wait
ruby-2.6.3 - #installing - please wait
ruby-2.6.3 - #making binaries executable - please wait
ruby-2.6.3 - #downloading rubygems-3.0.8
ruby-2.6.3 - #extracting rubygems-3.0.8 - please wait
ruby-2.6.3 - #removing old rubygems - please wait
ruby-2.6.3 - #installing rubygems-3.0.8 - please wait
ruby-2.6.3 - #gemset created /Users/mengshun/.rvm/gems/ruby-2.6.3@global
ruby-2.6.3 - #importing gemset /Users/mengshun/.rvm/gemsets/global.gems - please wait
ruby-2.6.3 - #generating global wrappers - please wait
ruby-2.6.3 - #gemset created /Users/mengshun/.rvm/gems/ruby-2.6.3
ruby-2.6.3 - #importing gemsetfile /Users/mengshun/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.6.3 - #generating default wrappers - please wait
ruby-2.6.3 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.6.3 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri


➜  Ruby: ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]


➜  Ruby: rvm use ruby-2.6.3
Using /Users/mengshun/.rvm/gems/ruby-2.6.3


➜  Ruby: rvm --default use 2.6.3
Using /Users/mengshun/.rvm/gems/ruby-2.6.3


3. Complete and then directly execute the POD installation command

➜  Ruby: sudo gem install -n /usr/local/bin cocoapods
Password:
Fetching concurrent-ruby-1.1.6.gem
Fetching thread_safe-0.3.6.gem
Fetching activesupport-4.2.11.1.gem
Fetching nap-1.1.0.gem
Fetching tzinfo-1.2.6.gem
Fetching i18n-0.9.5.gem
Fetching fuzzy_match-2.0.4.gem
Fetching httpclient-2.8.3.gem
Fetching ffi-1.12.2.gem
Fetching algoliasearch-1.27.1.gem
Fetching ethon-0.12.0.gem
Fetching typhoeus-1.3.1.gem
Fetching netrc-0.11.0.gem
Fetching cocoapods-core-1.9.1.gem
Fetching claide-1.0.3.gem
Fetching cocoapods-deintegrate-1.0.4.gem
Fetching cocoapods-downloader-1.3.0.gem
Fetching cocoapods-plugins-1.0.0.gem
Fetching cocoapods-search-1.0.0.gem
Fetching cocoapods-stats-1.1.0.gem
Fetching cocoapods-trunk-1.4.1.gem
Fetching cocoapods-try-1.1.0.gem
Fetching molinillo-0.6.6.gem
Fetching atomos-0.1.3.gem
Fetching CFPropertyList-3.0.2.gem
Fetching escape-0.0.4.gem
Fetching gh_inspector-1.1.3.gem
Fetching colored2-3.1.2.gem
Fetching cocoapods-1.9.1.gem
Fetching nanaimo-0.2.6.gem
Fetching xcodeproj-1.15.0.gem
Fetching fourflusher-2.3.1.gem
Fetching ruby-macho-1.4.0.gem
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.6
Successfully installed concurrent-ruby-1.1.6
Successfully installed i18n-0.9.5
Successfully installed activesupport-4.2.11.1
Successfully installed nap-1.1.0
Successfully installed fuzzy_match-2.0.4
Successfully installed httpclient-2.8.3
Successfully installed algoliasearch-1.27.1
Building native extensions. This could take a while...
Successfully installed ffi-1.12.2
Successfully installed ethon-0.12.0
Successfully installed typhoeus-1.3.1
Successfully installed netrc-0.11.0
Successfully installed cocoapods-core-1.9.1
Successfully installed claide-1.0.3
Successfully installed cocoapods-deintegrate-1.0.4
Successfully installed cocoapods-downloader-1.3.0
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-search-1.0.0
Successfully installed cocoapods-stats-1.1.0
Successfully installed cocoapods-trunk-1.4.1
Successfully installed cocoapods-try-1.1.0
Successfully installed molinillo-0.6.6
Successfully installed atomos-0.1.3
Successfully installed CFPropertyList-3.0.2
Successfully installed colored2-3.1.2
Successfully installed nanaimo-0.2.6
Successfully installed xcodeproj-1.15.0
Successfully installed escape-0.0.4
Successfully installed fourflusher-2.3.1
Successfully installed gh_inspector-1.1.3
Successfully installed ruby-macho-1.4.0
Successfully installed cocoapods-1.9.1
Parsing documentation for thread_safe-0.3.6
Installing ri documentation for thread_safe-0.3.6
Parsing documentation for tzinfo-1.2.6
Installing ri documentation for tzinfo-1.2.6
Parsing documentation for concurrent-ruby-1.1.6
Installing ri documentation for concurrent-ruby-1.1.6
Parsing documentation for i18n-0.9.5
Installing ri documentation for i18n-0.9.5
Parsing documentation for activesupport-4.2.11.1
Installing ri documentation for activesupport-4.2.11.1
Parsing documentation for nap-1.1.0
Installing ri documentation for nap-1.1.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for httpclient-2.8.3
Installing ri documentation for httpclient-2.8.3
Parsing documentation for algoliasearch-1.27.1
Installing ri documentation for algoliasearch-1.27.1
Parsing documentation for ffi-1.12.2
Installing ri documentation for ffi-1.12.2
Parsing documentation for ethon-0.12.0
Installing ri documentation for ethon-0.12.0
Parsing documentation for typhoeus-1.3.1
Installing ri documentation for typhoeus-1.3.1
Parsing documentation for netrc-0.11.0
Installing ri documentation for netrc-0.11.0
Parsing documentation for cocoapods-core-1.9.1
Installing ri documentation for cocoapods-core-1.9.1
Parsing documentation for claide-1.0.3
Installing ri documentation for claide-1.0.3
Parsing documentation for cocoapods-deintegrate-1.0.4
Installing ri documentation for cocoapods-deintegrate-1.0.4
Parsing documentation for cocoapods-downloader-1.3.0
Installing ri documentation for cocoapods-downloader-1.3.0
Parsing documentation for cocoapods-plugins-1.0.0
Installing ri documentation for cocoapods-plugins-1.0.0
Parsing documentation for cocoapods-search-1.0.0
Installing ri documentation for cocoapods-search-1.0.0
Parsing documentation for cocoapods-stats-1.1.0
Installing ri documentation for cocoapods-stats-1.1.0
Parsing documentation for cocoapods-trunk-1.4.1
Installing ri documentation for cocoapods-trunk-1.4.1
Parsing documentation for cocoapods-try-1.1.0
Installing ri documentation for cocoapods-try-1.1.0
Parsing documentation for molinillo-0.6.6
Installing ri documentation for molinillo-0.6.6
Parsing documentation for atomos-0.1.3
Installing ri documentation for atomos-0.1.3
Parsing documentation for CFPropertyList-3.0.2
Installing ri documentation for CFPropertyList-3.0.2
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Parsing documentation for nanaimo-0.2.6
Installing ri documentation for nanaimo-0.2.6
Parsing documentation for xcodeproj-1.15.0
Installing ri documentation for xcodeproj-1.15.0
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
Parsing documentation for gh_inspector-1.1.3
Installing ri documentation for gh_inspector-1.1.3
Parsing documentation for ruby-macho-1.4.0
Installing ri documentation for ruby-macho-1.4.0
Parsing documentation for cocoapods-1.9.1
Installing ri documentation for cocoapods-1.9.1
Done installing documentation for thread_safe, tzinfo, concurrent-ruby, i18n, activesupport, nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, cocoapods-trunk, cocoapods-try, molinillo, atomos, CFPropertyList, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 145 seconds
33 gems installed


➜  Ruby: pod --version
1.9.1

Upgrade successful!

About Xcode command phasescriptexecution failed with a nonzero exit code solution

1. Problem description

USES Xcode for code writing, and the following error has been reported during the compilation process when the new project code is pulled down during project development.

Command PhaseScriptExecution failed with a nonzero exit code

after searching on the Internet, most of the solutions given on the Internet were as follows. However, after I tried, the problem was not solved, but more mistakes were reported. Therefore, I consulted my tutor again, and finally got the solution.

encountered this bug hint when running a project, which could not be compiled. This is actually a bug caused by Xcode10. Solution: Select File -&gt in Xcode menu bar; Workspace Setting -> Choose Legacy Build System to rerun.

The primary cause of

is that the workspace is full, leading to code compilation errors, and there are roughly two ways to solve this problem.

(1) enter the code working cache folder of Xcode to clean manually ( is error-prone, is not recommended)

(2) use only the cleaning method provided by Xcode directly. Xcode will automatically link the working file after cleaning the workspace ( will not make mistakes, is recommended)

because the second method is easier to work with and less likely to go wrong, we use this method directly in the solution.

ii. Solution

1. First in Product -> Scheme selects the main code module for the current project

2. Select Product -> Clean Build Folder Clean workspace

3. Recompile the project code after

Command codesign failed with a nonzero exit code or revoke certificate for IOS / Xcode problems

if you have experienced a similar error, try my method and see if you can solve it. The error case diagram is as follows:

  1. according to my experience, the cause of this problem is that I mistakenly reset the keychain access to the default, so I lost my development certificate.
  2. how do I solve this problem?
  3. I clean up my apple development certificate from Keychain Access
  4. I clean up my apple development private key
  5. and I get a new error: Revoke certificate Your account already has an Apple Development signing certificate for this machine, But its private key is not installed in your keychain. Xcode can create a new one after revoking your existing certificate.
  6. relocates to Xcode-> Preferences-> The Accounts tags – & gt; Find team name -&gt under Apple ID; Double-click on it – & gt; Click the + button in the bottom left corner of the box -> Select App Development
  7. in the project -> Signing & Capabilities-> From the Team drop-down menu, select “None”
  8. to re-select the correct development Team
  9. to rebuild the CMD + b project
  10. by shift + CMD + k clean project

iOS Xcode:Failed to create provisioning profile.

compile error:

Failed to create provisioning profile. The app ID “com.aaa.bbb.demo” cannot be registered to your development team. Change your bundle identifier to a unique string to try again.

fix: open Build Settings, search for “bundle”, change the Product bundle Identifier option, change it to an unused package name, problem solved.

Xcode compilation error: failed to initiate service connection to simulator

Failed to initiate service connection to simulator Error returned in reply: connection invalid

opened xcode and ran successfully. Then click on the simulator and there was no response. Reruns this prompt box and clear the cache.
solution: you need to close all the different versions of xcode and the emulator, and just reopen and run.
because multiple versions of xcode are open running

Mac ports installation software prompts “warning: xcodebuild exists but failed to execute”


# port search imagemagick

checked on the Internet, tried the following method, success.

The steps which solved for me were:

1.install Xcode 4.3 from Mac App Store

2. Install Command Line Tools for Xcode

3. sudo /usr/bin/xcode-select -switch /Applications/Xcode.app

4. sudo ln -s `which clang` /Applications/Xcode.app/Contents/Developer/usr/bin/

Even so, this is clearly a workaround.

my xcode is downloadable DMG, perform dynamic mount every time I start, so the directory is /Volumes/ xcode. app/…

for users from appstore installation goal should be to/Application/Xcode. The app /…

, I only have to do step3 to succeed.