tonymillion / Reachability

ARC and GCD Compatible Reachability Class for iOS and MacOS. Drop in replacement for Apple Reachability
BSD 2-Clause "Simplified" License
6.98k stars 1.26k forks source link

CocoaPods, Reachability, and use_frameworks! #95

Open g0ld2k opened 9 years ago

g0ld2k commented 9 years ago

With CocoaPods 0.36, they added the capability to generate frameworks for pods. For Swift projects, using frameworks eliminates the need for a Objective-C bridge.

Podfile:

    # Uncomment this line to define a global platform for your project
    platform :ios, "8.0"
    use_frameworks!

    target "VB ParkFinder" do
    pod 'ArcGIS-Runtime-SDK-iOS', '~> 10.2'
    pod 'Reachability', '~> 3.2'
    pod 'TUSafariActivity', '~> 1.0.3'
    pod 'NHCalendarActivity', '~> 0.0.1'
    end

    target "VB ParkFinderTests" do

    end

Reachability works great as a Framework, however when submitting the app to Apple, Apple incorrectly identifies Reachability as being a private API (it looks like there is a private API class called Reachability), which causes the app to be rejected.

Dear developer,

We have discovered one or more issues with your recent delivery for "VB ParkFinder". To process your delivery, the following issues must be corrected:

Non-public API usage:

The app contains or inherits from non-public classes in VB ParkFinder: Reachability

If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.

If you think this message was sent in error and that you have only used Apple-published APIs in accordance with the guidelines, send the app's nine-digit Apple ID, along with detailed information about why you believe the above APIs were incorrectly flagged, to appreview@apple.com. For further information, visit the Technical Support Information page.

Once these issues have been corrected, you can then redeliver the corrected binary.

Regards,

The App Store team

None of the other Pods in my project caused this issue.

I was able to work around the issue by removing the use_frameworks! line from my Podfile and creating a Objective-C bridging file, no other code was changed. My submission without use_frameworks! passed Apple's initial checks without a problem.

I'm not sure what the solution would be, but it sounds like there is a collision occurring with Apple's private frameworks due to the naming of your project.

tonymillion commented 9 years ago

Thats a new one! The solution, I suppose, would be to rename the framework as something else while keeping the name for compiled projects?

albertbori commented 9 years ago

+1

Got rejected for the same reason. I'd rather not remove use_frameworks!. Is there another quick solution for this?

Cinamonas commented 9 years ago

+1

Our's got rejected due to this, too.

formvoltron commented 9 years ago

time for a rename it seems.

tonymillion commented 9 years ago

I agree - I have a lot of work right now, but I'd like to look into if you can detect when being compiled as a framework and change the class name dynamically.

formvoltron commented 9 years ago

Why not just TMReachability? We'll know it's still Reachability under the hood. :)

On Mon, Apr 20, 2015 at 11:09 AM, Tony Million notifications@github.com wrote:

I agree - I have a lot of work right now, but I'd like to look into if you can detect when being compiled as a framework and change the class name dynamically.

— Reply to this email directly or view it on GitHub https://github.com/tonymillion/Reachability/issues/95#issuecomment-94414026 .

salabaha commented 9 years ago

Faced the same problem today. Renaming should fix it.

allaire commented 9 years ago

:+1:

cpatterson commented 9 years ago

I'm also facing this problem. Can't remove use_frameworks! because we're using some Swift pods. None of the forks I've looked at seem to rename everything properly for CocoaPods.

albertbori commented 9 years ago

@cpatterson I forked and use this regularly to get my app into the app-store. It might be a few fixes behind. I was planning on bringing it up-to-date soon™ (if needed): https://github.com/albertbori/Reachability

@tonymillion I recommend renaming the items in question to TMReachability instead of chasing the golden helicopter solution. Especially since this issue is a) a blocking issue, and b) over two months old.

taylortrimble commented 9 years ago

@tonymillion: you added the big warning in the README for this issue; but if you don't mind me saying, that's not really a solution that helps a CocoaPods user, which is where this issue was discovered. :wink:

TMReachability?

warpling commented 9 years ago

I'm struggling a bit with this. I renamed Reachability's files and classes and successfully submitted to Apple but after a pod install I am getting linker errors with TMReachability. Is there a correct way to fix this via the pod or should I just ditch the pod in favor of my own fork or copying in the files manually?

Cinamonas commented 9 years ago

@warpling: as per @albertbori suggestion, that's what I'm currently doing:

pod 'TMReachability', :git => 'https://github.com/albertbori/Reachability', :commit => 'e34782b386307e386348b481c02c176d58ba45e6'
warpling commented 9 years ago

Thanks @Cinamonas, I missed that! I ended up just pulling in the two files and renaming them.

wasnotrice commented 9 years ago

@albertbori thanks for sharing your fork. fixed this issue for me!

dougdiego commented 9 years ago

+1

parallaxe commented 9 years ago

+1

DaveCole commented 9 years ago

@Cinamonas solution somehow works for me when I run it on the phone, but fails when I attempt an App Store archive. Anyone else run into this?

warpling commented 9 years ago

@DaveCole different target for release/debug perhaps? Can you run it on your phone in release mode? (You can change the mode in Product > Edit Scheme)

dlo commented 7 years ago

@Cinamonas Thanks so much for creating that fork! Works great. 👍