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

post_install App Extension for AFNetworking "undefined method `project'" Xcode 7 Beta 3 #3811

Closed
traviscrist opened this issue Jul 11, 2015 · 9 comments

Comments

Projects
None yet
2 participants
@traviscrist
Copy link

commented Jul 11, 2015

When using Cocoa Pods 0.37.2 and Xcode 7 Beta 3 attempting to make an archive I ran into Issue 3738 which according to it was resolved by the 0.38 beta.

The log of that error is below:

"sent 29 bytes received 20 bytes 98.00 bytes/sec
total size is 0 speedup is 0.00
building file list ... done
rsync: push_dir#3 "/Users/USER_DIR/Library/Developer/Xcode/DerivedData/APPNAME-brndwvawqziufcbioqjtodevvppi/Build/Intermediates/ArchiveIntermediates/APPNAME/InstallationBuildProductsLocation" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at /SourceCache/rsync/rsync-45/rsync/main.c(580) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [sender=2.6.9]
Command /bin/sh failed with exit code 12"

I then tried using 0.38.0.beta.2 but there was an error about an undefined method project when it attempts to run my post install script which adds AF_APP_EXTENSIONS to the GCC_PREPROCESSOR_DEFINITIONS for a Today Extension. Below is the error when attempting to run the command pod install:

/APP_NAME/Podfile:24:in block (2 levels) in from_ruby' /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.38.0.beta.2/lib/cocoapods-core/podfile.rb:170:incall'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.38.0.beta.2/lib/cocoapods-core/podfile.rb:170:in post_install!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/installer.rb:756:inrun_podfile_post_install_hook'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/installer.rb:744:in block in run_podfile_post_install_hooks' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/user_interface.rb:140:inmessage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/installer.rb:743:in run_podfile_post_install_hooks' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/installer.rb:154:inblock in generate_pods_project'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/user_interface.rb:59:in section' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/installer.rb:149:ingenerate_pods_project'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/installer.rb:109:in install!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/command/project.rb:71:inrun_install_with_update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/command/project.rb:156:in run' /Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:inrun'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/lib/cocoapods/command.rb:48:in run' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0.beta.2/bin/pod:44:in'
/usr/bin/pod:23:in load' /usr/bin/pod:23:in

The post install portion of my pod file looks like:

post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        if target.name == "Pods-EXTENSION_NAME-AFNetworking"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
    end
end

This all worked just fine with 0.37.2 but when using 0.38.0.beta.2 it now fails. Any ideas?

@segiddins

This comment has been minimized.

Copy link
Member

commented Jul 12, 2015

Yes, the post install script needs to be updated for 0.38, see the release notes at https://github.com/CocoaPods/CocoaPods/releases/tag/0.38.0.beta.2 for more information. The gist is, project needs to be changed to pods_project.

@segiddins segiddins closed this Jul 12, 2015

@traviscrist

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

Hello,

Thanks for the tip, I changed project to pods_project and now it can run pod install successfully but the post install script is no longer being applied correctly. It doesn't appear to be applied at all.

If I revert to 0.37.2 and project it installs it correctly as the GCC_PREPROCESSOR_DEFINITIONS.

Any other ideas or can you point me to the specific release note that made this change, I was unable to figure it out from the release notes linked to.

The new post install looks like:

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        if target.name == "Pods-EXTENSION_NAME-AFNetworking"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
    end
end

Thanks for the assistance.

@segiddins

This comment has been minimized.

Copy link
Member

commented Jul 14, 2015

The target name is probably no longer Pods-EXTENSION_NAME-AFNetworking but rather AFNetworking

@traviscrist

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

Thanks, that got the project building with it applying using the updated target below:

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        if target.name == "AFNetworking"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
    end
end

Now when I go to make an archive I am running into this error:

building file list ... done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
building file list ... done
rsync: push_dir#3 "/Users/dragon/Library/Developer/Xcode/DerivedData/APP_NAME-brndwvawqziufcbioqjtodevvppi/Build/Intermediates/ArchiveIntermediates/EXTENSION_NAME_WITH_SPACE/InstallationBuildProductsLocation" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at /SourceCache/rsync/rsync-45/rsync/main.c(580) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [sender=2.6.9]
Command /bin/sh failed with exit code 12

Which I think is the same error as in the closed issue 3738. This was all with 0.38.beta.2, any ideas?

@segiddins

This comment has been minimized.

Copy link
Member

commented Jul 14, 2015

Is the target name really EXTENSION-TARGET ?

@traviscrist

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

Nope, I just replaced it so the actual name is not public. Updated it so the full name is visible as is in the error.

@segiddins

This comment has been minimized.

Copy link
Member

commented Jul 14, 2015

Judging by the other issue, the problem seems to be caused by special characters or spaces in the target name. Please open another issue with an attached project we can use to debug, thanks!

@traviscrist

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

Ah there is a space in it. Let me see if removing that will resolve the issue.

@traviscrist

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

Created a new issue, it doesn't appear to be a problem with the space. I made a sample project and the same issue is seen for an today extension with or without a space. See issue 3819. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.