iOS   发布时间:2022-05-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 尝试使用CocoaPods 0.38关闭MagicalRecord登录时出错大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我正在使用这个SO问题的解决方案: Cocoapods: turning MagicalRecord logging off在我将CocoaPods更新到最新版本(0.38.2)之前曾经运作良好.现在每当我运行pod install命令时,它都会返回几个错误. 作为参,这是ank(link)共享的原始Podfile片段: post_install do |installer| target
我正在使用这个SO问题的解决方案: Cocoapods: turning MagicalRecord logging off在我将CocoaPods更新到最新版本(0.38.2)之前曾经运作良好.现在每当我运行pod install命令时,它都会返回几个错误.

作为参,这是ank(link)共享的原始Podfile片段:

post_install do |installer|
  target = installer.project.targets.find{|t| t.to_s == "Pods-MagicalRecord"}
    target.build_configurations.each do |config|
        s = config.build_setTings['GCC_PREPROCESSOR_DEFinitioNS']
        s = [ '$(inherited)' ] if s == nil;
        s.push('MR_ENABLE_ACTIVE_RECORD_LOGGING=0') if config.to_s == "Debug";
        config.build_setTings['GCC_PREPROCESSOR_DEFinitioNS'] = s
    end
end

我遇到的第一个问题是需要用Podfile上的pods_project替换项目,所以我做了.

但让我陷入困境的是它无法识别build_configurations语句,正如您在控制台上看到的错误

...
Generating Pods project
[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `build_configurations' for nil:NilClass
...

我已经搜索过该问题,但无法从SO或gitHub或其他网站找到适合它的解决方案.我相信可能需要进行一些更改才能使代码片段在此版本的CocoaPods上再次运行,因此我想知道是否有人提出了解决此问题的@L_618_21@,或者是否有另一种@L_618_21@可以关闭loggin for MagicalRecord(BTW我使用的是2.2版本).

这是我的Podfile的最后一部分:

post_install do |installer|
    target = installer.pods_project.targets.find{|t| t.to_s == "Pods-MagicalRecord"}
    target.build_configurations.each do |config|
        s = config.build_setTings['GCC_PREPROCESSOR_DEFinitioNS']
        s = [ '$(inherited)' ] if s == nil;
        s.push('MR_ENABLE_ACTIVE_RECORD_LOGGING=0') if config.to_s == "Debug";
        config.build_setTings['GCC_PREPROCESSOR_DEFinitioNS'] = s
    end
end

任何帮助将受到广泛赞赏:)

解决方法

我发现你需要在post_install中添加以下行来使用“R_319_11845@agicalRecord”而不是“Pods-MagicalRecord”:

puts installer.pods_project.targets

我的解决方代码

# Turn off Magical Record logging in debug mode - in release mode it is off by default
target = installer.pods_project.targets.find{|t| t.to_s == "MagicalRecord"}
target.build_configurations.each do |config|
  s = config.build_setTings['GCC_PREPROCESSOR_DEFinitioNS']
  s = [ '$(inherited)' ] if s == nil;
  # Uncomment one matching your version
  #s.push('MR_ENABLE_ACTIVE_RECORD_LOGGING=0') if config.to_s == "Debug"; # MagicalRecord < 2.3
  #s.push('MR_LOGGING_DISABLED=1') if config.to_s == "Debug"; # MagicalRecord 2.3+
  config.build_setTings['GCC_PREPROCESSOR_DEFinitioNS'] = s
end
@H_301_51@

大佬总结

以上是大佬教程为你收集整理的ios – 尝试使用CocoaPods 0.38关闭MagicalRecord登录时出错全部内容,希望文章能够帮你解决ios – 尝试使用CocoaPods 0.38关闭MagicalRecord登录时出错所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。