Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Issues integrating UnityAds

Discussion in 'Unity Mediation' started by eeveahy-x, Feb 26, 2023.

  1. eeveahy-x

    eeveahy-x

    Joined:
    Mar 12, 2022
    Posts:
    14
    Hi,
    I have spent hours trying to implement unityads to my iOS game through cocoapods, however I am running into several issues. I am genuinely stuck with this, as I have been on so many forums trying every solution I could find and still nothing.

    For context: I built this unity project on my windows pc, then moved the entire folder over to my mac to integrate ads and ship build to App Store Connect (I am hoping this is where the issue comes from).

    I have cocoapods 1.11.3._1 installed through brew, since I cannot get ruby to work. Ruby either gives
    Could not find 'minitest' (>= 5.1) among 39 total gem(s) (Gem:MissingSpecError)

    or, if I execute
    sudo gem install cocoapods

    It returns
    ERROR: While executing gem ... (Gem:FilePermissionError) You don't have write permissions for the /System/Library/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory

    From what I read online you fix this by executing
    sudo gem install cocoapods --user-install

    However this returns a different error
    ERROR: While executing gem ... (Errno:EACCES) Permission denied @ dir_s_mkdir - /Users/username/.local/share/gem/specs
    Which I'm guessing I can fix by moving into a folder I have permissions for (although I don't know how to do that). So that brings me back to brew, since everyone who got around this issue just used brew.

    My project file DOES have a file name 'Podfile', and a folder called 'Pods'. I have the newest version of the advertisement package installed, but there is NO xcodeworkspace file in the project. In another thread this issue was fixed by doing Assets>Mobile Dependency Resolver> iOS Resolver> Settings and selecting Xcode Workspace as the integration type. This does nothing. I should also mention that going iOS Resolver>Install Cocoapods will just tell me I already have it installed.

    When I build the project I get two errors: "FileNotFoundException: Could not find file "/Users/username/Desktop/BuildFolder/Podfile.lock" and "Error running CocoaPods. Please ensure you have at least version 1.0.0" (As stated above, I have version 1.11.3. ALSO stated above, Unity can see this). The error prompts me to execute
    sudo gem install -n /usr/local/bin cocoapods
    Which, as stated above returns the Gem:FilePermissionError.

    Out of curiosity, I tried to build the xcodeproj file in the Unity build, and I get the error 'UnityMediationSdk/UnityMediationSdk.h' file not found.

    Hopefully you can understand this has been very frustrating! I am mostly unfamiliar with using the terminal, so any help is appreciated.