1

I am using https://github.com/sindresorhus/LaunchAtLogin as it reduces the hassle to implement Launch At Login from Scratch.

I did follow all the instructions in the README as follows -

Made a Podfile & installed with pod install

platform :osx, '10.12'

target 'myApp' do
  use_frameworks!
  pod 'LaunchAtLogin'
end

Added a new "Run Script Phase" below "Embed Frameworks" in "Build Phases" with the following:

./Pods/LaunchAtLogin/LaunchAtLogin/copy-helper.sh

But I get the error

cp: /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/LaunchAtLoginHelper.app: No such file or directory Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure

As you can clearly decode from the error LaunchAtLoginHelper.app cannot be found at /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/ that's why the build is failing.

How do I generate that or what should I do to sort this thing out because this makes Launch At Login not work?

I also made a simplest demo for the app to see if it works but it doesn't - https://github.com/deadcoder0904/LaunchAtLoginPod

PS - I have also code signed the application as I did follow this & checked it with codesign -dvv /Applications/myApp.app & it returned Build Time perfectly.

Cœur
  • 37,241
  • 25
  • 195
  • 267
deadcoder0904
  • 7,232
  • 12
  • 66
  • 163

2 Answers2

0

I had the same issue while using Carthage instead of CocoaPods. Currently, there seem to be lots of open CocoaPods' related issues in this project's repository so you might consider trying Carthage and follow these steps.

I solved this issue using the following steps:

  1. In XCode, under Build Settings, under signing, make sure Code Signing Identity is set to either Sign to Run Locally or any other form of actual signing
  2. Use this tutorial to install Carthage
  3. Follow the install and usage of the package, using Carthage, as appears in the README file here: https://github.com/sindresorhus/LaunchAtLogin
  4. Delete all of the contents in DerivedData
  5. To make sure, also clean the project: (Product -> Clean Build Folder)
  6. In your project's folder, execute carthage build
  7. There should now be a new folder inside your project's root folder named Carthage. Inside, there is a Build folder. Search for the file LaunchAtLogin.framework.dSYM (note the .dSYM extension)
  8. In XCode, under Build Phases, in Embed Frameworks step, drag and drop the .dSYM file (see image below)
  9. Change the destination to Products Directory (see image below)
  10. Check the Code Sign On Copy checkbox of this framework (see image below)
  11. Add another step New Run Script Phase, make sure it runs the native shell (/bin/sh). Inside, add this line: exec "${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh" (this is the line that appears in the repository) - (see image below)
  12. Make sure that the script appears after the embedded framework
  13. Build and run

image for steps 8-12

Ori
  • 1,680
  • 21
  • 24
-1

Not exactly an answer but found an alternate solution.

I couldn't solve this with CocoaPods but I did make a simple demo with Carthage & it worked.

Here's the link for the interested - https://github.com/deadcoder0904/LaunchAtLoginCart

Edit:

Found the solution thanks to Ferruccio

Add a new "Run Script" below "[CP] Embed Pods Frameworks" in "Build Phases" with the absolute path to copy-helper.sh.

For simplicity, you can just drag & drop copy-helper.sh. Drag it inside label Shell. Then change Location to Absolute Path

Also you can try https://github.com/deadcoder0904/LaunchAtLoginPod as a simple working demo.

XCODE DEMO IMAGE

deadcoder0904
  • 7,232
  • 12
  • 66
  • 163