Tag Archives: ios

Flutter project package IOS error [How to Solve]

Flutter packs IPA and reports an error course not find an option named “track widget creation”.
it should be caused by the different forms of dart language in debug mode and release mode.
in debug mode, flutter supports more dynamic language features such as hot overload, and these features are turned off in release mode

$flutter build ios --release


Openssh installation error after IOS jailbreak [How to Solve]

Install openssh error

Try restarting the phone to reinstall

Set the phone language to English

set the phone to flight mode and download it with WiFi (my solution)

After the above steps, IOS 8.4 jailbreak successfully downloaded openssh

Then install network command in Cydia

Run ifconfig – L and the result is as follows

 ifconfig -l
lo0 pdp_ip0 pdp_ip1 pdp_ip2 pdp_ip3 ap1 en0 en1 awdl0
wodeshouji:~ root# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet netmask 0xff000000 
pdp_ip0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
pdp_ip1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
pdp_ip2: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
pdp_ip3: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
ap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
    ether aa:88:08:47:f0:e7 
    inet netmask 0xffffff00 broadcast
    ether a8:88:08:47:f0:e7 
    ether aa:88:08:47:f1:7f 
    ether 66:1a:ae:c0:52:0b


En0 is the local network card, packet capture command

tcpdump -X -s0 -i en0 -w /tmp/dump.pcap

Then download dump.pcap and put it into Wireshark for analysis

[IOS series] -A server with the specified hostname could not be found. Problem solved

Reveal can easily view the layout of the interface in iOS development. It is more convenient to find out that the view (etc.) does not appear or is blocked, which saves a lot of time.

But today Reveal has a problem:A server with the specified hostname could not be found.

Screenshot below:

Google took a look and found an article that might tell the truth about the problem.

Reference documents

There is a sentence in it

The real issue was that I had messed up my /etc/hots file and localhost was broken.

So that is, the hosts file is damaged, then check the hosts file and execute it in the terminal: (It is not a vim party, so I am used to using the open command, the system will call the editor to open)

 open /etc/hosts


# SwitchHosts!
# My Hosts

It turns out that the hosts have really been tampered with. Reveal seems to need port.

So change the hosts file back, as follows (how to change is described later):

# SwitchHosts!
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##	localhost	broadcasthost
::1             localhost 

After thinking about it, I discovered that the hosts file was modified a few days ago. The tool used is: SwitchHosts! An open source software that integrates management and switching N Hosts solutions.

SwitchHosts download page -you can choose the latest version to download

Note: It is invalid to modify the hosts file directly. I want to execute su /etc/hostsit with administrator authority , but it always returns su: Sorry, but I can modify it directly if I have SwitchHosts, so I don’t pay attention to the issue of this authority.

Modify interface of hosts file

After saving, open Reveal again to find it can be used.

[Solved] IOS Package Error: ARCHIVE FAILED:Command CodeSign failed with a nonzero exit code



Open project with Xcode

Command + K restart the computer

Reference: Xcode packing error command codesign failed with a nonzero exit code

[wrong guess]

After reading other people’s summary, I feel that it may be the problem caused by updating the Mac operating system


Xcode packaging failed: xcrun codesign failed with exit code 1


Here is the requirement after upgrading MacOS High Sierra

1. Set the login password and the password of Apple Developer account (= = icloud), otherwise

2. Later, I jumped out of the login dialog box many times and asked to enter icloud’s password – “because I couldn’t remember the password clearly at that time

3. After that, I entered the correct password immediately, but due to network problems, I failed to log in normally

4. And later, although the network was successful and the password was correct, it did not disappear because of the previous pop-up box

This seems to lead to:

The apple related (project) Certificate in login is estimated to be unable to be accessed normally

-, which leads to an error in codesign when Xcode goes to archive to package the project

The solution is:

Make sure that icloud’s login password has been updated and logged in after upgrading MacOS High Sierra

Here is:

Restart the Mac, making the previous box disappear

When you want to enter the password, enter the correct password and log in to icloud

If not, go to Keychain to reset the login password

Keychain access edit change password for Keychain login

In this way, Xcode can have the right to access the certificate in the keychain with the correct password, and can code design and package normally

[Solved] Error in uploading app icon when IOS app is released (image can’t contain alpha channels or transparencies)

Today, when I published iOS app to AppStore, the webpage prompted an error when I uploaded App icon (image can’t contain alpha channels or transparencies), and after checking online, I found that Apple officially set new rules for App icon upload. Previously, it was OK to upload a PNG image. Now you need to open the PNG image with preview to generate a JPEG image, and then upload it again.

There are other solutions, as follows.

Solution 1

AFAIK png with transparency is not allowed. use jpg OR update your png (photoshop or whatever you using to create the png) and delete the transparency areas. if you work with shadows, use jpg, that will do no headaches.

Solution 2

I’ve found you can also just re-export the png’s in Preview, but uncheck the Alpha checkbox when saving.

Solution 3

For this i made a new simple tool. You can remove alpha channel (transparency) of multiple .png files within seconds.

You can download from here http://alphachannelremover.blogspot.com

Solution 4

Usemogrifytool fromImageMagickpackage to remove alpha channel.

brew install imagemagick
cd folder_with_images
mogrify -alpha off */*.png

Update from May 3

You can tell whether image contains alpha channel by running:

sips -g all image.png

In case you render screenshots in iOS Simulator you can drop alpha channel by passingBOOL opaque = YEStoUIGraphicsBeginImageContextWithOptions:

UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0); 

Solution 5

If you are using Photoshop go File > Save for web (Command + Option + Shift + S). Make sure the Transparency is unchecked and this should work.

Solution 6

i have same problem just compress your png file on https://tinypng.com/ online and then try to upload that new compressed png file.

its work for me.

Solution 7

i was able to useimageoptimto remove alpha channel and compress png files.

Solution 8

You can remove the alpha channel from a PNG file from the command line with pngcrush, using the flag “-c 2”:

$ file input.png
input.png: PNG image data, 1024 x 1024, 8-bit/color RGBA, non-interlaced
$ pngcrush -q -c 2 input.png output.png
libpng warning: iCCP: known incorrect sRGB profile
$ file output.png
output.png: PNG image data, 1024 x 1024, 8-bit/color RGB, non-interlaced

Note the change from RGBA to RGB: the Alpha channel is gone!

pngcrush lives at http://pmt.sourceforge.net/pngcrush/

Solution 9

On Pixelmator you can use ‘Share > Export for Web…’ (⇧+⌘+E)

and deselectTransparencyin the Tool Options Bar.

Solution 10

You must remove alpha channels when uploading a photo.

You can do this by Preview, Photos App (old iPhoto), Pixelmatr or even Adobe Photoshop. I will explain it in Preview.

First, open a photo in Preview. If the photo is in your photo album in Photos app (the old iPhoto), then simply drag it from the album to desktop. Then control-click (right-click when mouse) the duplicated photo and select Preview.app under Open With menu.

Second, Select Export… under File menu, and after selecting the destination, uncheck Alpha at the bottom, and export.

Finally, upload the new photo to iTunes Connect.

Solution 11

To get around the problem I batched converted using fireworks my png32 files to png24 for upload quick and easy. Jpeg works also but it is lossy.

Solution 12

If you have imagemagick installed, then you can put the following alias into your .bash_profile. It will convert every png in a directory to a jpg, which automatically removes the alpha. You can use the resulting jpg files as your screen shots.

alias pngToJpg='for i in *.png; do convert $i ${i/.png/}.jpg; done'

Solution 13

What worked for me here was using a jpg file instead of PNG as jpg files don’t use alpha or transparency features. I did it via online image converter or you can also open the image in preview and then File->Export and uncheck alpha as option to save the image and use this image.

Solution 14

Convert your PNG image to JPEG format.


The problem and solution of local storage in Safari under IOS

One of our small applications uses Baidu map API to get the user’s coordinates, and then uses localstorage to do the next cache. After the test goes online, some students from the operation feedback that the page data can’t be pulled

No problem was found during the test, and one of the two identical iPhones could work and the other could not. Finally, it was found that there was a problem with localstorage

But why is it that two mobile phones of the same version can be used one by one

And the two mobile phones are all objects. It’s strange

I didn’t find the answer on Du Niang. Finally, I went to Google and found that it was caused by private browsing mode. Then check the safari of IOS and find no privacy settings

Later, click on the small box in the lower right corner to find a traceless browsing mode. The solution is as follows:

Method 1

// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem
// throw QuotaExceededError. We’re going to detect this and just silently drop any calls to setItem
// to avoid the entire page breaking, without having to do a check at each usage of Storage.
if (typeof localStorage === ‘object’) {
try {
localStorage.setItem(‘localStorage’, 1);
} catch (e) {
Storage.prototype._ setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function() {};
alert(‘Your web browser does not support storing settings locally. In Safari, the most common cause of this is using “Private Browsing Mode”. Some settings may not save or some features may not work properly for you.’);

Method 2

Using cookies to store data (for small amount of data)

Traceless mode should disable the localstorage object, but window. Localstorage exists, but document. Cookie can be used

 try {
        localStorage.setItem('isPrivateMode', '1');
        window.isPrivateMode = false;
    } catch(e) {
        window.isPrivateMode = true;
    if (!window.isPrivateMode && window.localStorage) { // 不是 Safari 无痕模式并且能用 localStorage



            var cookie = new cookies();




var cookies = function(){};
cookies.prototype = {
    setCookie:function(c_name, value, expiredays){
        var exdate=new Date();
        exdate.setDate(exdate.getDate() + expiredays);
        document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ?"" : ";expires="+exdate.toGMTString());
        var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");

            return (arr[2]);
            return null;

        var cookie = new cookies();
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval=cookie.getCookie(name);
            document.cookie= name + "="+cval+";expires="+exp.toGMTString();


Jenkins ios rror: No signing certificate “iOS Distribution” found: No “iOS Dist…

The error prompt is as follows:

error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "YQL2NV3V7T" with a private key was found. (in target 'HelloWorld')


The answers found on the Internet are all like this. It doesn’t work even if you try

Jenkins encountered problems in automatically building IOS package signature


Before compiling, add security unlock Keychain – P “your password” “path to Keychain/login. Keychain”

The root cause is Jenkins, SSH mode to slave machine, default is no account, but access to the key chain must have user identity, so add a step to enter the password to unlock the key chain, you can give Jenkins a user identity. Add a step to unlock the key chain before the build step. security unlock-keychain -p “login pwd” ~/Library/Keychains/login.keychain



Modification process:

It’s a matter of system user rights

I put Tomcat + Jenkins in the root directory

However, the certificate configured by Xcode is in a subdirectory under login user/user/Wangju

Then start Jenkins. The. Jenkins directory is also generated in the/user/Wangju directory

It’s not easy to use many methods. Finally, I moved Jenkins’ installation directory to/user/Wangju/Library Directory

start Tomcat again, log in Jenkins , execute the packing command, and the amazing thing is that the packing is successful. Now it’s still a bit confusing, but it’s finally solved this problem. I want to cry when I see that I can type the xcatchive file. From about 7 pm yesterday to 11 pm, I have been thinking about this problem, and then to 11 pm today, it’s almost 7 hours, and I finally don’t need to re install the system to get it done. Let’s have a good time

Attach a path of Tomcat startup file

This problem is repeated again, and the solutions are as follows:

CD to Tomcat file installation directory

Stop Tomcat service

Start Tomcat service

After restarting tomcat, the Java icon appears on the desktop. It’s strange that Jenkins can also be used before, but there is no Java icon on the desktop?It is suspected that there is something wrong with the way I started tomcat, so after the computer was restarted, Jenkins packaging was affected

It seems that this is the reason

note: when I use launch to start tomcat, the program execution is normal, but I can’t start the service, and the permission modification is done, but it’s still useless

———————-Dividing line———————-

In addition, I also changed the permissions of the user directory where the certificate is located. I don’t know if there is such a reason

Select system preferences & gt> Sharing can be configured


I also moved these files in the directory of/user/xxx/library/keychains to the directory of/var/root/library/keychains. I tried, but it didn’t seem to work. Finally, I deleted the copied files

Now I don’t know which step affects the final result after so many operations, but if I encounter the problem of IOS packaging again, I will definitely not change the system configuration file (before configuration, I changed the Mac computer name, administrator user name and home directory, but it’s strange that I changed the administrator user name to ABC, CBA is always displayed on the command line. I don’t know if this is the cause of my configuration error. User rights, etc.)

I think this kind of answer may also be OK, but I didn’t try

Note: the password can be added to the credential. If Jenkins is downloaded from the root user, please change/etc/sysconfig/Jenkins to root, otherwise an error will be reported; Or create a new ordinary user, and modify it

Then restart: Service Jenkins restart

Bridging mechanism of toll free bridging in IOS

Toll free bridging, referred to as TFB, is a mechanism that allows some objc classes and their corresponding corefoundation classes to be used interchangeably. For example, nsstring and cfstring are bridged, which means that any nsstring can be used as a cfstring, or any cfstring can be used as an nsstring

There are a number of data types in the core foundation framework and the foundation framework that can be used interchangeably. This capability, called toll free bridging, means that you can use the same data type as the parameter to a core foundation function call or as the receiver of an Objective-C message

The principle (take nsstring as an example) is: nsstring is an abstract class. Whenever you create an instance of nsstring, it is actually a private subclass instance of nsstring. One of the private subclasses is nscfstring, which is the corresponding class of cfstring class in objc. Nscfstring implements all the methods needed as an nscfstring

My understanding: in short, you know that there is a toll free bridging mechanism, and nscfstring is a private subclass of nsstring, which implements all its methods. See the official website for detailed explanation

Why cfstring

Explanation on the official website:

CFString provides a suite of efficient string-manipulation and string-conversion functions. It offers seamless Unicode support and facilitates the sharing of data between Cocoa and C-based programs

On this point, I also recommend a better blog post:

Toll Free Bridging

Xcode Error: Command CodeSign failed with a nonzero exit code

Some solutions on the Internet are: Command + K, and then restart the computer. Just run it again.

But it is invalid for me. My reason is that the system library import location of accounts. Framework (the part circled in red below) is wrong. So I deleted the library and re imported it to run normally.

How to delete and add: select targets – & gt; build phases–> Link binary with libraries, find the corresponding library (I’m here accounts. Framework), click minus sign to delete, and click plus sign to add.


Xcode Command PhaseScriptExecution failed with a nonzero exit code

1.Problem description

Use Xcode to write code. During the process of compiling new project code, the following error has been reported all the time.

Command PhaseScriptExecution failed with a nonzero exit code

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

When running a project, I encountered this bug prompt. I can’t compile it all the time. This is actually a bug caused by xcode10. Solution: in the Xcode menu bar, select File – > Workspace Setting -> Build system select legacy build system to run again.

The main reason for this problem is that the workspace is full, which leads to errors in code compilation. There are two ways to solve this problem.

(1) Enter Xcode’s code work cache folder for manual cleaning (error prone, not recommended)

(2) Just use the cleaning method provided by Xcode. After Xcode cleans up the workspace, it will automatically link the working files (no error, recommended)

Because the second method is relatively easy to operate and is unlikely to make mistakes, we directly use this method to solve the problem.


1. First, in product – > Select the main code module of the current project in scheme

2. Select product – > Clean build folder cleans up the workspace

3. Recompile the project code later