Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK missing AdServices import - iOS #33

Open
scottholdren opened this issue Mar 12, 2021 · 5 comments
Open

SDK missing AdServices import - iOS #33

scottholdren opened this issue Mar 12, 2021 · 5 comments

Comments

@scottholdren
Copy link

A recent update to the SDK has removed the AdServices import, which is breaking iOS builds. Manually setting

pod 'Branch', '1.38.0'
has fixed it for now.

@stevecarlton
Copy link

stevecarlton commented Mar 22, 2021

+1 for breaking our iOS builds.

@scottholdren do you mind clarifying where you added this? I tried adding at the bottom of /ios/App/Podfile by got an error when running ionic cap sync:

[!] CocoaPods could not find compatible versions for pod "Branch":
  In Podfile:
    Branch (= 1.38.0)

Edit: I did the following below and unfortunately still got the build error ld: framework not found AdServices

  1. Added pod 'Branch', '1.38.0' in the target 'App' do section of /ios/App/Podfile
  2. Went to /ios/App in terminal and ran pod install --repo-update

@scottholdren
Copy link
Author

I am appending it to /ios/App/Podfile, followed by some stuff to fix bitcode errors.

I am running

pod repo update
ionic capacitor add ios
cat build_resources/Podfile.extras >> ios/App/Podfile

in that order every time.

build_resources/Podfile.extras

pod 'Branch', '1.38.0'

def disable_bitcode_for_target(target)
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'

      remove_cflags_matching(config.build_settings, ['-fembed-bitcode', '-fembed-bitcode-marker'])
    end
end

def remove_cflags_matching(build_settings, cflags)
  existing_cflags = build_settings['OTHER_CFLAGS']

  removed_cflags = []
  if !existing_cflags.nil?
    cflags.each do |cflag|
      existing_cflags.delete_if { |existing_cflag| existing_cflag == cflag && removed_cflags << cflag }
    end
  end

  if removed_cflags.length > 0
    build_settings['OTHER_CFLAGS'] = existing_cflags
  end
end

post_install do |installer|
  project_name = Dir.glob("*.xcodeproj").first
  project = Xcodeproj::Project.open(project_name)
  project.targets.each do |target|
    disable_bitcode_for_target(target)
  end
  project.save

  installer.pods_project.targets.each do |target|
    disable_bitcode_for_target(target)
  end

  installer.pods_project.save
end

@stevecarlton
Copy link

I am appending it to /ios/App/Podfile, followed by some stuff to fix bitcode errors.

I am running

pod repo update
ionic capacitor add ios
cat build_resources/Podfile.extras >> ios/App/Podfile

in that order every time.

build_resources/Podfile.extras

pod 'Branch', '1.38.0'

def disable_bitcode_for_target(target)
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'

      remove_cflags_matching(config.build_settings, ['-fembed-bitcode', '-fembed-bitcode-marker'])
    end
end

def remove_cflags_matching(build_settings, cflags)
  existing_cflags = build_settings['OTHER_CFLAGS']

  removed_cflags = []
  if !existing_cflags.nil?
    cflags.each do |cflag|
      existing_cflags.delete_if { |existing_cflag| existing_cflag == cflag && removed_cflags << cflag }
    end
  end

  if removed_cflags.length > 0
    build_settings['OTHER_CFLAGS'] = existing_cflags
  end
end

post_install do |installer|
  project_name = Dir.glob("*.xcodeproj").first
  project = Xcodeproj::Project.open(project_name)
  project.targets.each do |target|
    disable_bitcode_for_target(target)
  end
  project.save

  installer.pods_project.targets.each do |target|
    disable_bitcode_for_target(target)
  end

  installer.pods_project.save
end

Thank you, I'll give this a shot!

@nbiles
Copy link

nbiles commented Apr 4, 2021

Having the same issue still.

@KirstenStake
Copy link
Contributor

same issue. has anyone got this working with pod 'Branch', '1.39.4' ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants