2017-10-25 13 views
5

मुझे कोकोपोड्स में शामिल निर्भरताओं के साथ कोई समस्या है।कक्षा दोनों में लागू की गई है, दोनों में से एक का उपयोग किया जाएगा। कौन सा अपरिभाषित

मेरे पास एक फ्रेमवर्क प्रोजेक्ट (माईफ्रेमवर्क लक्ष्य) है, जिसमें ऐप लक्ष्य भी है (MyFrameworkExampleApp)। जब मैं अनुप्रयोग चलाने के लिए प्रयास करते हैं, मैं तो जैसे एक सांत्वना त्रुटियों से भरा मिलता है:

कक्षा PodsDummy_AFNetworking दोनों/निजी/var/कंटेनर/बंडल/आवेदन/AD85D7EC-2652-4019-94FB-C799D0FBA69B में कार्यान्वित किया जाता/MyFrameworkExampleApp.app/Frameworks/MyFramework.framework/MyFramework (0x1019a0438) और /var/containers/Bundle/Application/AD85D7EC-2652-4019-94FB-C799D0FBA69B/MyFrameworkExampleApp.app/MyFrameworkExampleApp (0x10107c558)। इन दोनों में से कोई एक प्रयोग किया जाएगा। कौन सा अपरिभाषित है।

बात है, त्रुटियों पुस्तकालयों से आते हैं केवल MyFramework में शामिल को लक्षित

यहाँ मेरी podfile की सामग्री हैं:

# Specify platform. 
platform :ios, '9.0' 

# Let's ignore all warnings from all pods 
inhibit_all_warnings! 

target 'MyFramework’ do 

    # ReactiveCocoa for easier binding between UI and data models. 
    pod 'ReactiveCocoa', '< 3.0' 

    # ReactiveViewModel for easier handling of active/inactive view models. 
    pod 'ReactiveViewModel', '0.3' 

    # An Objective-C extension with some nice helpers including @weakify/@strongify. 
    pod 'libextobjc', '~> 0.4.1' 

    # AFNetworking Security stuff 
    pod 'AFNetworking/Security', '~> 2.5.4' 

    # KZPropertyMapper to easily map JSON dicts to properties 
    pod "KZPropertyMapper" 

    # Simple wrapper for KeyChain 
    pod 'UICKeyChainStore', '~> 2.0.6' 

    # Animated gifs 
    pod 'FLAnimatedImage', '~> 1.0' 

    # Firebase push notifications 
    pod 'Firebase/Core' 
    pod 'Firebase/Messaging' 

    # Easy image downloading with cache. 
    pod 'SDWebImage', '~> 3.7.2' 

    # Activity indicator for RBSlider 
    pod 'DGActivityIndicatorView' 

end 

target 'MyFrameworkExampleApp' do 

    # Progress indicator 
    pod 'MBProgressHUD', '~> 1.0.0' 

    # Color picker 
    pod 'iOS-Color-Picker' 

    # Hockey SDK 
    pod 'HockeySDK', '~> 5.0.0' 

end 

आप देख सकते हैं, अनुप्रयोग लक्ष्य के वारिस नहीं है कोई फली, न ही मेरे पास कोई वैश्विक फली है। इसके लिए क्या कारण हो सकता है?

उत्तर

3

मुझे कारण पता नहीं है, लेकिन यदि आप अपने ऐप के पॉड्स- [AppName] .debug.xcconfig फ़ाइल खोलते हैं जो cocoapods बनाता है तो आपको OTHER_LDFLAGS मिलेंगे और आप इसे उसी फ्रेमवर्क के लिंक देखेंगे जो आप लिंक करते हैं आपका ढांचा तो यदि आप हटाते हैं -फ्रेमवर्क [डुप्लिकेट फ्रेमवर्क] चेतावनी गायब हो जाती है।

एक cocoapods त्रुटि

+1

यह एक CocoaPods मुद्दा है https://github.com/CocoaPods/CocoaPods/issues/7155 –

+1

पर * तो अगर आप -framework [दोहराए ढांचा] हटाने चेतावनी गायब हो जाता है *। - यह एक चेतावनी है, लेकिन यह वास्तव में रनटाइम पर क्रैश उत्पन्न करता है, उदाहरण के लिए जब ReactiveCocoa –

+0

का उपयोग करना यह पागल है। इसका मतलब है कि स्थिर/वर्ग चर रनटाइम पर ढांचे सीमा से परे स्थिर नहीं हैं - यह राज्य को भ्रष्ट कर सकता है और अपरिभाषित व्यवहार के सभी प्रकार बना सकता है (उदाहरण के लिए Google मानचित्र एसडीके इस तरह विफल रहता है)। कामकाज क्या है? – Marchy

0

मैंने यह भी पाया एक और एक स्क्रिप्ट किसी ने लिखा है कि स्वचालित रूप से बग को ठीक होने के लिए लगता है। यह वही है जो मैंने उपरोक्त उत्तर दिया है। अपने Podfile के लिए यह करें:

post_install do |installer| 
    sharedLibrary = installer.aggregate_targets.find { |aggregate_target| aggregate_target.name == 'Pods-[MY_FRAMEWORK_TARGET]' } 
    installer.aggregate_targets.each do |aggregate_target| 
     if aggregate_target.name == 'Pods-[MY_APP_TARGET]' 
      aggregate_target.xcconfigs.each do |config_name, config_file| 
       sharedLibraryPodTargets = sharedLibrary.pod_targets 
       aggregate_target.pod_targets.select { |pod_target| sharedLibraryPodTargets.include?(pod_target) }.each do |pod_target| 
        pod_target.specs.each do |spec| 
         frameworkPaths = unless spec.attributes_hash['ios'].nil? then spec.attributes_hash['ios']['vendored_frameworks'] else spec.attributes_hash['vendored_frameworks'] end || Set.new 
        frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename| 
         extension = File.extname filename 
         File.basename filename, extension 
        end 
        frameworkNames.each do |name| 
         if name != '[DUPLICATED_FRAMEWORK_1]' && name != '[DUPLICATED_FRAMEWORK_2]' 
          raise("Script is trying to remove unwanted flags: #{name}. Check it out!") 
         end 
         puts "Removing #{name} from OTHER_LDFLAGS" 
         config_file.frameworks.delete(name) 
        end 
       end 
      end 
      xcconfig_path = aggregate_target.xcconfig_path(config_name) 
      config_file.save_as(xcconfig_path) 
     end 
    end 
end 
संबंधित मुद्दे

 संबंधित मुद्दे