Tag Archives: ios

[Solved] SSZipArchive Decompress Error: failed to open file in zip file

1. Add manually and drag ssziparchive library directly, and an error will be reported

Error Domain=SSZipArchiveErrorDomain Code=-2 “failed to open file in zip file”

2. Solution

Notes for using ssziparchive:

Add the following GCC_ PREPROCESSOR_ DEFINITIONS:

HAVE_ INTTYPES_ H HAVE_ PKCRYPT HAVE_ STDINT_ H HAVE_ WZAES HAVE_ ZLIB $(inherited).

build Setting-Preprocessor Macros–Multiple values (Double-Click), add the following codes:

HAVE_INTTYPES_H HAVE_PKCRYPT HAVE_STDINT_H HAVE_WZAES HAVE_ZLIB $(inherited)

Screenshot:

[Solved] Uniapp packaging IOS error: Apple root certificate is not installed in the current system

Hbuilderx: for IOS peace of mind packaging, MacOSX 10.14 and below systems need to install relevant certificates

Treatment method:

1. Open the certificate directory

2. Click the certificate, enter the computer password, allow the key chain to access, and confirm that the certificate is valid in the key chain

3. Other certificates in the certificate directory should also be obtained

IOS upgrade to xcode13 simulator running error

Xcode13 running simulator reports an error and the real machine is normal

building for iOS Simulator, but linking in object file built for iOS, xxxx for architecture arm64

Solution here is only a real and effective solution of my own

build settings -> Validate workspace (set to yes)

Set validate workspace to yes, and then run the simulator. The simulator really runs

https://stackoverflow.com/a/65306476

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 127.0.0.1 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 
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet 192.100.200.106 netmask 0xffffff00 broadcast 192.100.200.255
    ether a8:88:08:47:f0:e7 
en1: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
    ether aa:88:08:47:f1:7f 
awdl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1452
    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

appear

# SwitchHosts!
# My Hosts

It turns out that the hosts have really been tampered with. Reveal seems to need 127.0.0.1this 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.
##
127.0.0.1	localhost
255.255.255.255	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

[questions]

[solution]

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

From:

Xcode packaging failed: xcrun codesign failed with exit code 1

[summary]

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);
localStorage.removeItem(‘localStorage’);
} 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');
        localStorage.removeItem('isPrivateMode');
        window.isPrivateMode = false;
    } catch(e) {
        window.isPrivateMode = true;
    }
    if (!window.isPrivateMode && window.localStorage) { // 不是 Safari 无痕模式并且能用 localStorage
        localStorage.removeItem('scheme');
        localStorage.setItem('scheme',scheme);

        localStorage.removeItem('caiqrhost');
        localStorage.setItem('caiqrhost',caiqrhost);

        localStorage.removeItem('paytype');
        localStorage.setItem('paytype',paytype);

        localStorage.removeItem('classname');
        localStorage.setItem('classname',classname);
    }
    else{
        try{
            var cookie = new cookies();
            cookie.delCookie('scheme');
            cookie.delCookie('caiqrhost');
            cookie.delCookie('paytype');
            cookie.delCookie('classname');

            cookie.setCookie('scheme',scheme,30);
            cookie.setCookie('caiqrhost',caiqrhost,30);
            cookie.setCookie('paytype',paytype,30);
            cookie.setCookie('classname',classname,30);
            //alert(cookie.getCookie('classname'));
        }
        catch(e){
            alert(e);
        }

    }

cookie.operate.js

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());
    },
    getCookie:function(name){
        var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");

        if(arr=document.cookie.match(reg)){
            return (arr[2]);
        }
        else{
            return null;
        }

    },
    delCookie:function(name){
        var cookie = new cookies();
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval=cookie.getCookie(name);
        if(cval!=null){
            document.cookie= name + "="+cval+";expires="+exp.toGMTString();
        }        
    }
}

http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an