Tag Archives: development language

Runtime error – [xcodeproj] unknown object version. [How to Solve]

Error during pod install:

### Error

“`
RuntimeError – [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project.rb:227:in `initialize_from_file’
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.15.0/lib/xcodeproj/project.rb:112:in `open’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:1177:in `block (2 levels) in inspect_targets_to_integrate’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:1176:in `each’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:1176:in `block in inspect_targets_to_integrate’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:1171:in `inspect_targets_to_integrate’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:106:in `analyze’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:410:in `analyze’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:234:in `resolve_dependencies’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:156:in `install!’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run’
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run’
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>’
/usr/local/bin/pod:23:in `load’
/usr/local/bin/pod:23:in `<main>’
“`

Reason: Xcode version and CocoaPods version do not match, need to update CocoaPods
Solution.
Enter the command in the terminal

gem install cocoapods --pre

Error Messages:

ERROR:  While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

Plus permissions:

sudo gem install cocoapods --pre

Execute pod install again successfully!

[Solved] Initialization of anonymous inner class member variable causes java.lang.stackoverflowerror

Project scenario:

An abstract class A in Java needs to initialize a member variable of the same type anonymously,

public class Main {
  public static void main(String[] args) {
    new B();
  }

}

abstract class A {
   A a = new A() {//Member variables of the same type
     @Override
     void do_sth() {
       System.out.println("do nothing");
     }
   };
  abstract void do_sth();
}

class B extends A{

  @Override
  void do_sth() {
	System.out.println("doing B");
  }
}

Problem Description:

Java.lang.stackoverflowerror directly overflowed the stack


Cause analysis:

When creating object B, the anonymous inner class in object a is also created, and the inner class creates its own inner class, resulting in infinite recursion.


Solution:

Try not to use anonymous inner classes as member variables. If you want to use them, be sure to pay attention to whether they contain the possibility of infinite recursion.

[Solved] JSON parse error: Cannot deserialize instance of `java.util.ArrayList<..> out of START_OBJECT token;

JSON parse error: Cannot deserialize instance of java.util.ArrayList<com.sangfor.ngsoc.knowledge.to.UserEntity> out of START_OBJECT token;
1. problem replication
① First, configure both knowledge and auth services into eureka.

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

② The project path of auth service is:

server:
  port: 8081
  servlet.context-path: /ngso/AUTH/

③ Interface of remote auth service:

@Api(tags = "Usersheet")
@Slf4j
@Validated
@RestController
@ResponseResult
@RequestMapping("/api/v2")
public class UserController {

    @Autowired
    private IUserService userService;

    @PostMapping("/users/inner/exact")
    public PageData<UserEntity> exactPageQueryUserList(@Validated @RequestBody UserQo userQo,
                                                       @RequestParam(SessionKey.DOMAIN_ID) String domainId) {
        userQo.setDomainId(domainId);
        return userService.exactPageQueryUserList(userQo);
    }
}

④ Feign interface of knowledge service, calling the interface of remote auth service:

@FeignClient(name = "AUTH")
public interface AuthFeignService {
    @PostMapping("/ngso/AUTH/api/v2/users/inner/exact")
    PageData<UserResp> exactPageQueryUserList(
            @RequestBody UserReqDto userReqDto,
            @RequestParam(SessionKey.DOMAIN_ID) String domainId);
}

(5) calling feign interface in knowledge service:

@Override
public String addDoc() {
    List<String> userIds = new ArrayList<>();
     UserInfo userInfo = UserInfoShareHolder.getUserInfo();
    userIds.add(userInfo.getId());
    UserReqDto userReqDto = new UserReqDto(userIds);
    userReqDto.setPageNum(1);
    userReqDto.setPageSize(1);
    PageData<UserResp> pageDataApiResponse = authFeignService
        .exactPageQueryUserList(userReqDto, UserInfoShareHolder.getUserInfo().getDomainId());
}

Result error:

JSON parse error: Cannot deserialize instance of `java.util.ArrayList<com.sangfor.ngsoc.knowledge.to.UserEntity>` out of START_OBJECT token; 

2. Solutions

① First, directly call the auth service interface without using the remote service: localhost: 8081/NGSO/auth/API/V2/users/inner/exact

There are more code and message messages than the actual response data, indicating that the response data is encapsulated

{
    "code": 0,
    "message": "成功",
    "data": {
        "pageNum": 1,
        "pageSize": 1,
        "totalCount": 1,
        "data": [
            {
                "id": "fx-user-fec844b9e0dc0d80000004",
                "name": "sysadmin",
                "phone": "",
                "email": "",
                "description": "Built-in user: default platform system administrator account",
                "domainId": "fx-domain-fec833bfa0dbcc40000001",
                "projectId": " ",
                "enabled": 1,
                "createTime": "2021-10-18 15:41:17",
                "updateTime": "2021-10-21 16:35:11",
                "changeTime": "2021-10-18 16:44:37",
                "loginTime": "2021-10-21 16:35:11",
                "options": 0,
                "builtIn": 1
            }
        ]
    }
}

② View the code and add a layer of encapsulation:

@FeignClient(name = "AUTH" )
public interface AuthFeignService {
   @PostMapping("/ngso/AUTH/api/v2/users/inner/exact")
    ApiResponse<PageData<UserResp>> exactPageQueryUserList(
            @RequestBody UserReqDto userReqDto,
            @RequestParam(SessionKey.DOMAIN_ID) String domainId);
}

[Solved] LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

Error:
[!] Error installing DoubleConversion
[!] /usr/bin/git clone https://github.com/google/double-conversion.git /var/folders/_h/xtz7k0td2vv6r1hq9jswkyx40000gn/T/d20211021-51746-zrhmvm –template= –single-branch –depth 1 –branch v1.1.6
Cloning into ‘/var/folders/_h/xtz7k0td2vv6r1hq9jswkyx40000gn/T/d20211021-51746-zrhmvm’…
fatal: unable to access ‘https://github.com/google/double-conversion.git/’: LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
Solution:

git config --global --add remote.origin.proxy ""

If the above method doesn’t work

Find ways to improve the network and use mobile phone hotspots
take a look at pod install several times