Tag Archives: Xcode

Error reported by using nsautoreleasepool in Xcode

Today, when practicing the code on learning Objective-C on MAC, I entered the following code

NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];

//omitted

[pool drain];
return 0;

The error reported by the program is “nsautoreleasepool is unavailable: not available in automatic reference counting mode”

After searching, we know that learning Objective-C on MAC uses the old Xcode version, and arc feature is introduced in the version after xcode4.2 to automatically manage memory, so the following code should be sent as follows

@autoreleasepool{
//omitted.
}

PS: some people on the Internet suggest turning off arc in the settings to continue to use nssautoreleasepool. I wonder why this requirement exists. Is it because the old code is compiled with the new Xcode?If it’s a new project, you’d better try to use arc. After all, how wonderful it is to be able to automatically manage memory

[Solved] Unity Xcode Error: A build only device cannot be used to run this target

The unity code prompts on Xcode: A build only device cannot be used to run this target.

If the phone is not connected, you will have the above prompt, you can use the emulator to fix it first.

 

Solution:

In Unity, you must click on Build Settings > Player Settings And in Inspector, choose settings for iOS > Other Settings > SDK Version and make sure “Simulator SDK” is selected.

Now in Xcode, it can be viewed in the iPhone Simulator.

 

“Amd action: authenticate: SP” appears when MAC updates Xcode

Programmer algorithm practice must read, common Java API skills to share>>>

Error updating Xcode in app store, pop-up window shows: AMD action: authenticate: sp

Reason: I have two hard disks, one SSD, as the system disk; Another mechanical hard disk for data. In addition, the users directory is moved to the mechanical disk, and a soft connection is created on the SSD to point to users – because the users directory is too large for SSD. According to the analysis of the information obtained from Google, the reason is that the library directory is not on the SSD (system disk), which leads to this error

Solution:

1. First, find out the biggest folders in the users directory (a bit like tuning for “bottleneck”) – in my case, the library/Android folder. There are so many things in the SDK that exceed 40Gb – move them to another part of the mechanical disk and create a soft connection in the original location

2. Delete the soft connection to users on SSD

3. Copy the users directory back to the SSD hard disk; Because the biggest Android is no longer under users, SSD can accommodate it

4. Restart, update Xcode, success

Xcode Compilation: < Apple Mach-O Linker Warning > clang: error: no such file or directory: ‘xxx…

Xcode compilation error overview:

clang: error: no such file or directory: ‘CoreGraphics’

The general reason is that the import of link library content is missing. Under this kind of investigation, target – build phases – link library with library can basically solve the problem

Or the library or framework searchpath is not set in buildsettings

But… Today’s situation is a bit coquettish

Whether it is to re clone project or to delete and re import the class library that reported the error, it can not be solved

Moreover, after deleting, the framework in link bank with library will execute the error reporting information in the order of index and shoot the head library 😂

It took nearly three hours to find out

Is there such an insignificant option in boldsettings – other link flag

“-weak_ framework”

Before this problem did not appear, GIT only did a reset operation appeared

My colleague also had this modifier in his project, but he didn’t report an error, so he deleted it and added it

EH ha ha, the project of my colleague has also reproduced this problem

EMM… My predecessor called outsourcing… The pit left is really… Strong enough 👍

Goole couldn’t find this… Or did Du Niang find the answer

Portal:

https://stackoverflow.com/questions/3661300/what-is-a-weak-framework-reference

The purpose of this modifier is to make the framework compatible with more different versions of the system, and make weak reference to the framework

The key point is “there might also be some performance differences in start up time using apps with weak references to launch much lower.”

It may cause the program to start slowly, which is affected by the product 🐶 Know backhand is a slap

Xcode real machine testing could not find developer disk image solution

Website content quality is poor, distribution efficiency is too low how to do?Huawei engineers offer 5 unique skills>>>

Xcode real machine testing could not find developer disk image solution

When using Xcode for real machine debugging, sometimes according to the system of the real machine, there will be an error of could not find developer disk image. This is because the real machine system is too high or too low, and there is no matching configuration package file in Xcode. We can enter the storage directory of the configuration package through this path:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

There are some folders like this. If these folders don’t contain our real machine system, we can’t carry out real machine test. But we can solve the problem by adding the corresponding configuration package to this folder

If you don’t provide any files, you will feel like a pit father. Let’s give you a link. There are configuration packages for all versions from IOS 4.2 to 9.1. You can get what you need. Don’t thank me:

http://pan.baidu.com/s/1qYIQWjE 。

Focus on technology, love life, exchange technology, also be friends

— hunshao QQ group: 203317592

Please connect the device in Xcode upgrade 11.7

Why can’t you stop buying 618?From the technical dimension to explore>>>

today, my little sister told me to give me the latest IOS test pack

For this kind of requirement, there must be a demand and it must be met immediately! Who knows Xcode keeps telling me

iPhone is not available.Pleasere connect the device!

Yes, I thought it could be solved by re plugging, but I didn’t solve it by restarting the computer! At this time, I can only tell my little sister that I have to wait for a while, and this Xcode is in trouble again. Please forgive me for using flutter to develop and plug in IOS

Silently opened the degree Niang to check for a while, everybody said is the version is not right. With a flash in my head, I upgraded Xcode on September 2. This is my first running environment. I’ve heard that Xcode can’t be updated at will, otherwise there will be problems. But I can’t see a with red on it. Every time there is an update, it must be updated! Now open it and see what Xcode updates

Xcode said that IOS 13.7 system is supported now, but I quietly opened my mobile phone to see the version, 13.6.1! Why didn’t I update?At this time, I silently looked at all the iPhones in the office. It seems that not only my iPhone 5 has not been updated, but also the latest top configuration of the iPhone has not been updated! The idea of buying a new mobile phone has been called back and can be used again! Ha ha ha

Now how to do, holding the mobile phone for a long time, “about the mobile phone” there is a “system update”, after entering, there is a 13.7 version of the system can be updated, decisive update

Update complete, package, complete

[Solved] LD: library not found for – XXX when Xcode compiles code

Sometimes under Xcode, we need to introduce a third-party class library or a static library written by ourselves. If the configuration is not correct, the following error will occur

ld: library not found for -XXXX

clang: error: linker command failed with exit code 1 (use -v to see invocation)。

Most of the time, there may be a problem with the connection reference of one of your libraries. The solution is to select. A or framework in link binary with libraries in the target of the project, cancel it and then add it

Modification method

1. Configuration under target

Target->”Build Phases”->”Link binary With Libraries” 
This is the name of the library to add. If it's an internal Xcode library, just look for it and add it. If you are looking for a third-party static or dynamic library, you will need to click "Add Other..." to install it.

2、Project

If you have found or written a third-party static or dynamic library, you also need to add the paths 
Project-> "Build Setting"-> "Search Paths"-> "Library search Paths" 
Add the path where the library is located

3. Configuration under other link flags (it may not be processed after deleting the third party framework)

Target->” Build Setting”->”Other Link Flags, Find the third party related to the error report, select it and then click on the minus sign to delete it

[How to Solve] Xcode:No such module SwiftyJSON

SwiftyJSON is a great third-party library for the Swift language, mainly dealing with JSON data, written by ThoughtWorks’ engineering master Ruo Yu.

When using SwiftyJSON, Xcode reports an error: No such module ‘SwiftyJSON’

SwiftyJSON Github:

Manually (iOS 7+, OS X 10.9+):

To use this library in your project manually you may:
for Projects, just drag SwiftyJSON.swift to the project tree
for Workspaces, include the whole SwiftyJSON.xcodeproj

Initialization

import SwiftyJSON
let json = JSON(data: dataFromNetworking)
let json = JSON(jsonObject)

Problem recurrence:

Xcode: Version 7.1.1 (7B1005)

Create a new project and select Single View Application.

Follow the instructions in SwiftyJSON and drag and drop SwiftyJSON.swift directly into the project using the manual method.

Then use import in UIViewController to introduce SwiftyJSON.

import UIKit  
import SwiftyJSON  //Xcode ERROR: No such module 'SwiftyJSON'  

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

Xcode: no such module ‘swiftyjson’

Solution:

After a search on the Internet, many people have encountered this problem. On stackoverflow, I found that someone answered:

If you added SwiftyJSON.swift to your project, you don’t need to import it.
It’s already available.

Originally, the swiftyjson.swift file was added to the project, so you don’t need to import it again, you can use it directly( (dizzy)

You can directly use the JSON () method in your code:
let JSON = JSON (data: datafromnetworking)
let JSON = JSON (JSON object)

References:

http://stackoverflow.com/questions/26754481/example-handling-json-with-swiftyjson
https://github.com/SwiftyJSON/SwiftyJSON
https://github.com/lingoer/SwiftyJSON

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.

2.Solutions

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