sweetpad-dev / sweetpad

Develop Swift/iOS projects using VSCode
https://marketplace.visualstudio.com/items?itemName=sweetpad.sweetpad
MIT License
117 stars 3 forks source link

Build Fails for iOS Simulator with Cocoapods-Managed Dependencies in Notification Service Extensions #4

Closed devmea closed 2 months ago

devmea commented 2 months ago

Hello!

I've recently started using VSCode to work on a project, and came across your extension. The extension looks fantastic so far, and I'm eager to continue using it in hopes I can replace Xcode with VSCode, though I know I'll still need it for some other stuff.

But I've encountered a build issue when using it with Cocoapods for managing dependencies. I have two extra targets with Notification Service Extensions, and the build fails with files not found:

  • Executing task: set -o pipefail && xcodebuild -scheme 'dev' -sdk iphonesimulator -configuration 'dev-debug' -workspace /Users/devmea/Projects/ios/app.xcodeproj/project.xcworkspace -destination 'generic/platform=iOS Simulator' -resultBundlePath '/Users/devmea/Library/Application Support/Code/User/workspaceStorage/2ef09f3a867dfd4c26a4bbe0dc1152b8/sweetpad.sweetpad/bundle/dev' -allowProvisioningUpdates build | xcbeautify (...) [InsiderNotificationService] Processing Info.plist [InsiderNotificationContent] Processing Info.plist [InsiderNotificationService] Compiling NotificationService.m ❌ /Users/devmea/Projects/ios/InsiderNotificationService/NotificationService.m:10:9: 'InsiderMobileAdvancedNotification/InsiderPushNotification.h' file not found

    import <InsiderMobileAdvancedNotification/InsiderPushNotification.h>

    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    [InsiderNotificationContent] Compiling NotificationViewController.m ❌ /Users/devmea/Projects/ios/InsiderNotificationContent/NotificationViewController.m:11:9: 'InsiderMobileAdvancedNotification/iCarousel.h' file not found

    import <InsiderMobileAdvancedNotification/iCarousel.h>

    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    (...) BUILD FAILED

The following build commands failed: CompileC /Users/devmea/Library/Developer/Xcode/DerivedData/app-azpobefpptiqgsbyzyiqnvqxhbgg/Build/Intermediates.noindex/app.build/dev-debug-iphonesimulator/InsiderNotificationService.build/Objects-normal/x86_64/NotificationService.o /Users/devmea/Projects/ios/InsiderNotificationService/NotificationService.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'InsiderNotificationService' from project 'app') (1 failure)

  • The terminal process "/opt/homebrew/bin/zsh '-l', '-c', 'set -o pipefail && xcodebuild -scheme 'dev' -sdk iphonesimulator -configuration 'dev-debug' -workspace /Users/devmea/Projects/ios/app.xcodeproj/project.xcworkspace -destination 'generic/platform=iOS Simulator' -resultBundlePath '/Users/devmea/Library/Application Support/Code/User/workspaceStorage/2ef09f3a867dfd4c26a4bbe0dc1152b8/sweetpad.sweetpad/bundle/dev' -allowProvisioningUpdates build | xcbeautify'" terminated with exit code: 65.
  • Terminal will be reused by tasks, press any key to close it.

Does sweetpad support configurations where dependencies for app extensions are managed through Cocoapods, and if so, are there specific steps to ensure a successful build with such a setup?

Thank you!

hyzyla commented 2 months ago

πŸ‘‹ Hello! I've never worked with CocoaPods, so I will look this week at how the extension works with CocoaPods project.

For now, you can try this:

  1. Make sure that you can build and run the project using Xcode.
  2. Make sure that you have installed CocoaPods pod install.
  3. Send the file structure of your project and Podfile to me.

Thanks for creating the issue!

hyzyla commented 2 months ago

Hello!

It seems like you're using a .xcworkspace created by Xcode, not one created by CocoaPods.

... -workspace /Users/devmea/Projects/ios/app.xcodeproj/project.xcworkspace ...

To select the correct workspace (created by CocoaPods), run the command > SweetPad: Select Xcode workspace in your Command Palette (⌘ + C) and choose the one with the CocoaPods and Recommended labels.

Here is also how it looks like in the interface:

CleanShot 2024-04-06 at 00 05 14@2x

I've also created a demo project with CocoaPods named sweetpad-demo-cocoapods, where you can try to reproduce the issue.

Could you try this and let me know if it works for you?

devmea commented 2 months ago

Hello again!

Sorry, I've been out and didn't respond to the issue. The solution you posted works great, and I'm able to build and run on the simulator! πŸš€ Next step will be to be able to use breakpoints on VSCode, but I'll go through the documentation first, or maybe I'm missing something.

Thanks for the help! πŸ™