DoKit icon indicating copy to clipboard operation
DoKit copied to clipboard

Xcode 16.1 报错无法运行

Open CtrlJone opened this issue 1 year ago • 4 comments

It is recommended to refer to the following process before submitting issues:https://github.com/didi/DoraemonKit/issues/745 If you still cannot solve your problem, you can submit your issue according to the following template

Please complete the following informations.

Android、iOS? OS version? Brand? Expected behavior and actual behavior. Steps to reproduce the problem. More informations such as error messages and stack traces are welcomed.

建议提issues之前可以参考一下DoKit社区答疑流程:https://github.com/didi/DoraemonKit/issues/745 报错无法编译

请补充如下信息。 Xcode 16.1 Dokit version 3.1.3 image

CtrlJone avatar Nov 05 '24 09:11 CtrlJone

:git => 'https://github.com/m8282823/DoKit.git', :commit => 'b8281299b3b59fe1d5cda63bfa3753ac16241aea' 好像没人维护,用我这个吧

m8282823 avatar Nov 07 '24 02:11 m8282823

优秀 感谢

YunyueLin avatar Nov 18 '24 07:11 YunyueLin

把DoraemonFileSyncManager.m里的#import <FMDB/FMDB.h>改成#import <FMDB/fmdb/FMDatabase.h>就行了

DeanCarter avatar Dec 20 '24 10:12 DeanCarter

post_install do |installer|

  # 自动修复 DoraemonKit/Core 的 FMDB 大小写问题(带详细日志)
  puts "[DoraemonPatch] Begin patching FMDB import in DoraemonFileSyncManager.m"
  patched_files = 0
  scanned_files = 0

  begin
    files = Dir.glob('Pods/**/DoraemonFileSyncManager.m')
    puts "[DoraemonPatch] Candidate files: #{files.size}"

    files.each do |path|
      scanned_files += 1
      begin
        content = File.read(path)
      rescue => read_err
        warn "[DoraemonPatch] Read failed: #{path} (#{read_err})"
        next
      end

      if content.match?(/#import\s+<FMDB\/FMDB\.h>/)
        puts "[DoraemonPatch] Need patch: #{path}"
        fixed = content.gsub(/#import\s+<FMDB\/FMDB\.h>/, '#import <fmdb/FMDB.h>')

        # 确保可写(有些环境下 Pods 会只读)
        system("chmod u+w #{path}")

        begin
          File.open(path, 'w') { |f| f.write(fixed) }
        rescue => write_err
          warn "[DoraemonPatch] Write failed: #{path} (#{write_err})"
          next
        end

        # 二次校验
        begin
          verify = File.read(path).include?('#import <fmdb/FMDB.h>')
          if verify
            patched_files += 1
            puts "[DoraemonPatch] Patched OK: #{path}"
          else
            warn "[DoraemonPatch] Verify failed (pattern not found after write): #{path}"
          end
        rescue => verify_err
          warn "[DoraemonPatch] Verify read failed: #{path} (#{verify_err})"
        end
      else
        puts "[DoraemonPatch] Skip (no match): #{path}"
      end
    end
  rescue => e
    warn "[DoraemonPatch] Unexpected error: #{e}"
  end

  puts "[DoraemonPatch] Done. scanned=#{scanned_files}, patched=#{patched_files}"
end

上面是 结合AI提供的钩子 ,直接放到podfile中 需要的自取

bigNiuSanMao avatar Aug 25 '25 09:08 bigNiuSanMao