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

iOS build fails in Unity 2022.3.8 LTS: undefined method `[]' for nil:NilClass (NoMethodError) #252

Open
dmichalke2 opened this issue Aug 23, 2022 · 6 comments
Labels

Comments

@dmichalke2
Copy link

Description of the bug

when adding the nativegalery repo to our manifest.json to load the package from github to our project to use it in code, the build for iOS fails in Xcode with a ruby error. this only seems to happen with the latest Unity 2022.3X lts version (we use Unity 2022.3.8).

Reproduction steps

add nativegalery package to a unity 2022.3.8 project, use it, i.e. NativeGallery.LoadImageAtPath() and build for iOS.

Platform specs

Please provide the following info if this is a Unity 3D repository.

  • Unity version: e.g. 2022.3.8f1
  • Platform: iOS
  • Device: all (iOS build fails)
  • How did you download the plugin: manifest.json, added package

Screenshot_1

Additional info

xcode error log when building

378: [2022-08-22T10:20:00.626Z] - 6.3.4.2.4.2 - INFO: + Building with Xcode 13.2.1 379: /BUILD_PATH/.rvm/gems/ruby-2.4.2/gems/fastlane-2.182.0/fastlane/lib/fastlane/actions/update_project_provisioning.rb:73:in block (2 levels) in run': [!] undefined method []' for nil:NilClass (NoMethodError) 380: [2022-08-22T10:20:04.720Z] - 6.3.4.2.4.2 - ERROR: xcode build failed 381: RuntimeError (Build Failure): 382: Finished: FAILURE

@dmichalke2 dmichalke2 added the bug label Aug 23, 2022
@yasirkula
Copy link
Owner

Since the error message doesn't mention NativeGallery, can you try removing NativeGallery from your project and verify that it's the cause of the issue?

@dmichalke2
Copy link
Author

dmichalke2 commented Aug 23, 2022

yes, sorry I thought I expressed myself correctly. so as this screenshot in my first post shows, the package was added in the manifest.json.

when we remove it from the project (remove the line from the manifest.json and comment code that uses nativegallery), the iOS build works. so it is definitely the cause of the issue.

here I found a more detailed xcode log also mentioning nativegallery.

`Undefined symbols for architecture arm64:
"OBJC_CLASS$_PHPickerViewController", referenced from:
objc-class-ref in NativeGallery.o
"OBJC_CLASS$_PHPickerFilter", referenced from:
objc-class-ref in NativeGallery.o
"OBJC_CLASS$_PHPickerConfiguration", referenced from:
objc-class-ref in NativeGallery.o

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/Users/developer/builds/LEziGM3r/0/spiele-palast/pinochle/Build/IOS/de.spielepalast.pinochlepalace-appstore692/Unity-iPhone.xcodeproj: warning: MobileCoreServices has been renamed. Use CoreServices instead. (in target 'UnityFramework' from project 'Unity-iPhone')
/Users/developer/builds/LEziGM3r/0/spiele-palast/pinochle/Build/IOS/de.spielepalast.pinochlepalace-appstore692/Unity-iPhone.xcodeproj: warning: AssetsLibrary is deprecated. Consider migrating to Photos instead. (in target 'UnityFramework' from project 'Unity-iPhone')

** ARCHIVE FAILED **

The following build commands failed:
Ld /Users/developer/Library/Developer/Xcode/DerivedData/Unity-iPhone-ebrzqbbmqfdxmhfawpwagqfzukbr/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/UnityFramework.framework/UnityFramework normal (in target 'UnityFramework' from project 'Unity-iPhone')
(1 failure)

$ sed -i '' -e "s/PROV_UUID/${provuuid}/g" -e "s/TEAM_ID/${TEAM_ID}/g" exportOptions.plist
$ sed -i '' "s/SIGN_CERT/${SIGNING_IDENTITY}/g" exportOptions.plist
$ sed -i '' "s/EXPORT_METHOD/${EXPORT_METHOD}/g" exportOptions.plist
$ xcodebuild -exportArchive -archivePath Pinochle-Palace.xcarchive -exportPath Pinochle-Palace.ipa -exportOptionsPlist exportOptions.plist | tee export_archive.log

2022-08-22 14:45:26.609 xcodebuild[63742:7589902] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-22 14:45:26.609 xcodebuild[63742:7589902] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
error: archive not found at path '/Users/developer/builds/LEziGM3r/0/spiele-palast/pinochle/Build/IOS/de.spielepalast.pinochlepalace-appstore692/Pinochle-Palace.xcarchive'
** EXPORT FAILED **
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit status 1`

@yasirkula
Copy link
Owner

Something must be overwriting my automated setup. Can you try manual setup: https://github.com/yasirkula/UnityNativeGallery/wiki/Manual-Setup-for-iOS

@dmichalke2
Copy link
Author

I can try doing this for a local build but it doesnt solve the problem long term - we have a CI system that auto builds our app and needs the automated post build setup. also I have to mention that the problem is only in unity 2022.3.6+
in the previous version we used (2022.1.28f1) there was no issue, it is since the update to the latest unity LTS version. so it has to be a problem in the latest unity LTS version and the plugin.

@yasirkula
Copy link
Owner

Your local test results would be helpful, yeah. You can check if the necessary Other Linker Flags are present in Xcode because if not, then they're being overwritten somehow. I'd suspect that another plugin is now overwriting Other Linker Flags by mistake in a recent update since I haven't had a Unity-update-related native issue in a long while. But perhaps they've made significant changes to Xcode structure which've caused this problem. I can't verify this for the time being because I don't have access to a Mac workstation, unfortunately.

@ChrisMasterton
Copy link

@dmichalke2 I've had similar problems with flags and frameworks being overwritten. I've reverted to using a large hammer, also known as a custom Fastlane action that just sets whatever needs setting. It is not an elegant solution, but it gets the job done. Your issue is either the missing frameworks Photos and PhotosUI and/or the search path for those frameworks. I had the same problem - check out the Fastlane action fs_xcode

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

No branches or pull requests

3 participants